dsp: bios_table: Rename pldm_bios_table_attr_entry_string_decode_def_string_length_check()

Introduce
pldm_bios_table_attr_entry_string_decode_def_string_length(), deprecate
pldm_bios_table_attr_entry_string_decode_def_string_length_check(), add
the rename configuration and apply it.

As a consequence clang-tidy detected the following, though it's unclear
why it was not detected previously:

```
clang-tidy-17 -export-fixes /tmp/tmpf4lalo2j/tmpkiyu1sgy.yaml -p=/home/andrew/src/openbmc.org/openbmc/libpldm/origin/build1qcxy8ww -quiet /home/andrew/src/openbmc.org/openbmc/libpldm/origin/src/dsp/bios_table.c
../src/dsp/bios_table.c:460:2: error: Null pointer passed to 2nd parameter expecting 'nonnull' [clang-analyzer-core.NonNullParamChecker,-warnings-as-errors]
  460 |         memcpy(buffer, fields->def_string, length);
      |         ^              ~~~~~~~~~~~~~~~~~~
../src/dsp/bios_table.c:457:11: note: Assuming the condition is true
  457 |         length = length < (size - 1) ? length : (size - 1);
      |                  ^~~~~~~~~~~~~~~~~~~
../src/dsp/bios_table.c:457:11: note: '?' condition is true
../src/dsp/bios_table.c:460:2: note: Null pointer passed to 2nd parameter expecting 'nonnull'
  460 |         memcpy(buffer, fields->def_string, length);
      |         ^              ~~~~~~~~~~~~~~~~~~
```

gitlint-ignore: T1, B1
Change-Id: Ic390e00f520cb3d5e479604b34939cefd09e9448
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/src/dsp/bios_table.c b/src/dsp/bios_table.c
index 8e70c15..60b1f6d 100644
--- a/src/dsp/bios_table.c
+++ b/src/dsp/bios_table.c
@@ -403,25 +403,17 @@
 	return PLDM_SUCCESS;
 }
 
-static uint16_t pldm_bios_table_attr_entry_string_decode_def_string_length(
-	const struct pldm_bios_attr_table_entry *entry)
-{
-	struct attr_table_string_entry_fields *fields =
-		(struct attr_table_string_entry_fields *)entry->metadata;
-	return le16toh(fields->def_length);
-}
-
 LIBPLDM_ABI_STABLE
-int pldm_bios_table_attr_entry_string_decode_def_string_length_check(
+int pldm_bios_table_attr_entry_string_decode_def_string_length(
 	const struct pldm_bios_attr_table_entry *entry,
 	uint16_t *def_string_length)
 {
 	POINTER_CHECK(entry);
 	POINTER_CHECK(def_string_length);
 	ATTR_TYPE_EXPECT(entry->attr_type, PLDM_BIOS_STRING);
-	*def_string_length =
-		pldm_bios_table_attr_entry_string_decode_def_string_length(
-			entry);
+	struct attr_table_string_entry_fields *fields =
+		(struct attr_table_string_entry_fields *)entry->metadata;
+	*def_string_length = le16toh(fields->def_length);
 	return PLDM_SUCCESS;
 }
 
@@ -457,9 +449,20 @@
 	const struct pldm_bios_attr_table_entry *entry, char *buffer,
 	size_t size)
 {
-	uint16_t length =
-		pldm_bios_table_attr_entry_string_decode_def_string_length(
-			entry);
+	uint16_t length = 0;
+	int rc;
+
+	if (!entry || !buffer || size == 0) {
+		return 0;
+	}
+
+	/* TODO: Rework the API to propagate the error */
+	rc = pldm_bios_table_attr_entry_string_decode_def_string_length(
+		entry, &length);
+	if (rc != PLDM_SUCCESS) {
+		return 0;
+	}
+
 	length = length < (size - 1) ? length : (size - 1);
 	struct attr_table_string_entry_fields *fields =
 		(struct attr_table_string_entry_fields *)entry->metadata;
@@ -472,9 +475,11 @@
  */
 static ssize_t attr_table_entry_length_string(const void *entry)
 {
-	uint16_t def_str_len =
-		pldm_bios_table_attr_entry_string_decode_def_string_length(
-			entry);
+	uint16_t def_str_len = 0;
+
+	/* TODO: Rework the API to propagate the error */
+	pldm_bios_table_attr_entry_string_decode_def_string_length(
+		entry, &def_str_len);
 	size_t len =
 		pldm_bios_table_attr_entry_string_encode_length(def_str_len);
 	if (len > SSIZE_MAX) {