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

From: Thorsten Blum
Date: Tue Apr 01 2025 - 15:52:02 EST


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