]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: media: atomisp: replace sprintf() with strscpy()
authorTomasz Unger <tomasz.unger@yahoo.pl>
Thu, 26 Feb 2026 11:16:53 +0000 (12:16 +0100)
committerSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 20 May 2026 08:29:27 +0000 (11:29 +0300)
Auditing calls to sprintf(). This code is fine because we are
copying 9 characters into a 52 character buffer. But it would
be cleaner to use strscpy() instead. Additionally, the 2-argument
version of strscpy() checks at compile time that dst is an array,
not just a pointer.

This is the only sprintf() call in the whole driver.

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
drivers/staging/media/atomisp/pci/atomisp_subdev.c

index 3d56ca83ecb7c79f4f1c374f9a4f171626f0b180..cef44ec9ebde9d3106847cf9e1ca2ca8d9099f98 100644 (file)
@@ -808,7 +808,7 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
        int ret;
 
        v4l2_subdev_init(sd, &isp_subdev_v4l2_ops);
-       sprintf(sd->name, "Atom ISP");
+       strscpy(sd->name, "Atom ISP");
        v4l2_set_subdevdata(sd, asd);
        sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;