driver core: Use 2-argument strscpy()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Wed, 21 Aug 2024 15:48:23 +0000 (18:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Aug 2024 07:37:38 +0000 (15:37 +0800)
Use 2-argument strscpy(), which is not only shorter but also provides
an additional check that destination buffer is an array.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240821154839.604259-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c

index 980c08901cd08755ed04aab7b92ee9c06d76bc50..4bc8b88d697ee4b7658d359bdd2668dd554a6b9e 100644 (file)
@@ -4867,7 +4867,7 @@ set_dev_info(const struct device *dev, struct dev_printk_info *dev_info)
        else
                return;
 
-       strscpy(dev_info->subsystem, subsys, sizeof(dev_info->subsystem));
+       strscpy(dev_info->subsystem, subsys);
 
        /*
         * Add device identifier DEVICE=: