Skip to content

Commit 38c5b0d

Browse files
Wer-Wolfgroeck
authored andcommitted
hwmon: (dell-smm) Use strscpy_pad()
Using strscpy_pad() allows for fewer memory accesses since memset() will not unconditionally zero-out the whole buffer. Signed-off-by: Armin Wolf <[email protected]> Acked-by: Pali Rohár <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 6105870 commit 38c5b0d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/dell-smm-hwmon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/platform_device.h>
2626
#include <linux/proc_fs.h>
2727
#include <linux/seq_file.h>
28+
#include <linux/string.h>
2829
#include <linux/smp.h>
2930
#include <linux/types.h>
3031
#include <linux/uaccess.h>
@@ -472,8 +473,7 @@ i8k_ioctl_unlocked(struct file *fp, struct dell_smm_data *data, unsigned int cmd
472473
if (restricted && !capable(CAP_SYS_ADMIN))
473474
return -EPERM;
474475

475-
memset(buff, 0, sizeof(buff));
476-
strscpy(buff, data->bios_machineid, sizeof(buff));
476+
strscpy_pad(buff, data->bios_machineid, sizeof(buff));
477477
break;
478478

479479
case I8K_FN_STATUS:

0 commit comments

Comments
 (0)