* [PATCH] iio: move from strlcpy with unused retval to strscpy
@ 2022-08-18 21:00 Wolfram Sang
2022-08-19 8:07 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2022-08-18 21:00 UTC (permalink / raw)
To: linux-kernel
Cc: Wolfram Sang, Jonathan Cameron, Lars-Peter Clausen, linux-iio
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.
Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/iio/common/st_sensors/st_sensors_core.c | 2 +-
drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 9910ba1da085..35720c64fea8 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -354,7 +354,7 @@ void st_sensors_dev_name_probe(struct device *dev, char *name, int len)
return;
/* The name from the match takes precedence if present */
- strlcpy(name, match, len);
+ strscpy(name, match, len);
}
EXPORT_SYMBOL_NS(st_sensors_dev_name_probe, IIO_ST_SENSORS);
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
index 9b4298095d3f..f7bce428d9eb 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
@@ -65,7 +65,7 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
sub_elem = &elem->package.elements[j];
if (sub_elem->type == ACPI_TYPE_STRING)
- strlcpy(info->type, sub_elem->string.pointer,
+ strscpy(info->type, sub_elem->string.pointer,
sizeof(info->type));
else if (sub_elem->type == ACPI_TYPE_INTEGER) {
if (sub_elem->integer.value != client->addr) {
@@ -158,7 +158,7 @@ int inv_mpu_acpi_create_mux_client(struct i2c_client *client)
char *name;
info.addr = secondary;
- strlcpy(info.type, dev_name(&adev->dev),
+ strscpy(info.type, dev_name(&adev->dev),
sizeof(info.type));
name = strchr(info.type, ':');
if (name)
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iio: move from strlcpy with unused retval to strscpy
2022-08-18 21:00 [PATCH] iio: move from strlcpy with unused retval to strscpy Wolfram Sang
@ 2022-08-19 8:07 ` Andy Shevchenko
2022-08-19 17:25 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2022-08-19 8:07 UTC (permalink / raw)
To: Wolfram Sang
Cc: Linux Kernel Mailing List, Jonathan Cameron, Lars-Peter Clausen,
linux-iio
On Fri, Aug 19, 2022 at 12:02 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Follow the advice of the below link and prefer 'strscpy' in this
> subsystem. Conversion is 1:1 because the return value is not used.
> Generated by a coccinelle script.
Same comments as per similar patch you submit to PDx86.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: move from strlcpy with unused retval to strscpy
2022-08-19 8:07 ` Andy Shevchenko
@ 2022-08-19 17:25 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-08-19 17:25 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Wolfram Sang, Linux Kernel Mailing List, Lars-Peter Clausen, linux-iio
On Fri, 19 Aug 2022 11:07:56 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Fri, Aug 19, 2022 at 12:02 AM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> >
> > Follow the advice of the below link and prefer 'strscpy' in this
> > subsystem. Conversion is 1:1 because the return value is not used.
> > Generated by a coccinelle script.
>
> Same comments as per similar patch you submit to PDx86.
>
Given it was an easy split, I've turned this into two patches
and applied those to the togreg branch of iio.git - initially pushed
out as testing for 0-day to poke at it.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-19 17:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18 21:00 [PATCH] iio: move from strlcpy with unused retval to strscpy Wolfram Sang
2022-08-19 8:07 ` Andy Shevchenko
2022-08-19 17:25 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®