Re: [PATCH] staging: greybus: Remove unnecessary NUL-termination checks

From: Alex Elder
Date: Tue Apr 01 2025 - 15:55:24 EST


On 4/1/25 2:51 PM, Thorsten Blum wrote:
On 1. Apr 2025, at 01:31, Alex Elder wrote:
On 3/31/25 1:39 PM, Thorsten Blum wrote:
@@ -125,16 +125,6 @@ static int fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt,
strscpy_pad(fw_info->firmware_tag, response.firmware_tag);
- /*
- * The firmware-tag should be NULL terminated, otherwise throw error but
- * don't fail.
- */
- if (fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') {
- dev_err(fw_mgmt->parent,
- "fw-version: firmware-tag is not NULL terminated\n");
- fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] = '\0';
- }

Interesting this didn't return an error, while others below did.

Should I keep it that way when checking for a truncated firmware tag or
should this also fail like the others?

Thanks,
Thorsten

I don't know the answer right now, and I don't have time at
the moment to investigate. Just keep that logic the way it
is, and make your other fix.

-Alex