]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/mlx5: Use strscpy() to copy strings into arrays
authorDavid Laight <david.laight.linux@gmail.com>
Mon, 8 Jun 2026 09:54:57 +0000 (10:54 +0100)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 9 Jun 2026 17:57:37 +0000 (14:57 -0300)
Replacing strcpy() with strscpy() ensures that overflow of the target
buffer cannot happen.

Link: https://patch.msgid.link/r/20260608095500.2567-2-david.laight.linux@gmail.com
Signed-off-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/data_direct.c

index 8e89dbe40c2393c65ba013d89237249e116a311c..d57484245c3823512aee9852b2d0481d2df78751 100644 (file)
@@ -88,7 +88,7 @@ int mlx5_data_direct_ib_reg(struct mlx5_ib_dev *ibdev, char *vuid)
                return -ENOMEM;
 
        reg->ibdev = ibdev;
-       strcpy(reg->vuid, vuid);
+       strscpy(reg->vuid, vuid);
 
        mutex_lock(&mlx5_data_direct_mutex);
        list_for_each_entry(dev, &mlx5_data_direct_dev_list, list) {