]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: eth: benet: Use strscpy() to copy strings into arrays
authorDavid Laight <david.laight.linux@gmail.com>
Mon, 8 Jun 2026 09:54:59 +0000 (10:54 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Jun 2026 01:06:41 +0000 (18:06 -0700)
Replacing strcpy() with strscpy() ensures that overflow of the target
buffer cannot happen.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Link: https://patch.msgid.link/20260608095500.2567-4-david.laight.linux@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/emulex/benet/be_cmds.c

index eab81e073e1e74d218b7843161c8bd0941288ced..230c915593228c82cd68a54e75bd9f0cfa03191c 100644 (file)
@@ -2508,7 +2508,7 @@ int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
 
        req->desired_read_len = cpu_to_le32(data_size);
        req->read_offset = cpu_to_le32(data_offset);
-       strcpy(req->object_name, obj_name);
+       strscpy(req->object_name, obj_name);
        req->descriptor_count = cpu_to_le32(1);
        req->buf_len = cpu_to_le32(data_size);
        req->addr_low = cpu_to_le32((cmd->dma & 0xFFFFFFFF));