Skip to contentSkip to conversation

nfc: s3fwrn5: Prefer strscpy() over strcpy()

PATCH In review Abdul Rahim 2 participants 6 messages Oct 29, 2024 – Nov 26, 2024 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 nfc: s3fwrn5: Prefer strscpy() over strcpy()

strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors [1]

this fixes checkpatch warning:
WARNING: Prefer strscpy over strcpy

---
 drivers/nfc/s3fwrn5/firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/s3fwrn5/firmware.c +1 -1
index c20fdbac51c5..85fa84d93883 100644
@@ -469,7 +469,7 @@ void s3fwrn5_fw_init(struct s3fwrn5_fw_info *fw_info, const char *fw_name)
 	fw_info->parity = 0x00;
 	fw_info->rsp = NULL;
 	fw_info->fw.fw = NULL;
-	strcpy(fw_info->fw_name, fw_name);
+	strscpy(fw_info->fw_name, fw_name);
 	init_completion(&fw_info->completion);
 }
 
Signature · 1 line
2.46.0
maintainer Reviewed-by on v1 1/1
#2 lore raw
Quoted 6 lines · Abdul Rahim

strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors [1]

this fixes checkpatch warning:
WARNING: Prefer strscpy over strcpy

You should explain why it is safe to omit the destination buffer size.

Best regards,
Krzysztof

#3 lore raw

Do i need to resend it. What additional information do I need to provide?

#4 lore raw
Quoted 2 lines · Abdul Rahim

Do i need to resend it. What additional information do I need to provide?

You cut entire email, no clue what's this.

Best regards,
Krzysztof

#5 lore raw
Quoted 10 lines · Krzysztof Kozlowski
Quoted 2 lines · Abdul Rahim

Do i need to resend it. What additional information do I need to provide?

You cut entire email, no clue what's this.

Best regards,
Krzysztof

Do I need to resend this patch [1]. You gave it Reviewed-by tag. But it's not applied yet.

[1]: https://lore.kernel.org/lkml/[email protected]/

Thanks,
Abdul

#6 lore raw
Quoted 8 lines · Abdul Rahim
Quoted 7 lines · Krzysztof Kozlowski
Quoted 2 lines · Abdul Rahim

Do i need to resend it. What additional information do I need to provide?

You cut entire email, no clue what's this.

Quoted 8 lines
Quoted 3 lines

Best regards,
Krzysztof

Do I need to resend this patch [1]. You gave it Reviewed-by tag. But it's not applied yet.

[1]: https://lore.kernel.org/lkml/[email protected]/

First, it is merge window, no point to ping during that time. It is actually highly discouraged, unless this is a fix. And it is not a fix.

Second, this should have net-next PATCH prefix, see subsystem profile for networking.

I asked to change things in commit msg, so I expect next version, not resend.

Best regards,
Krzysztof