提交 38c5b0dd 编写于 作者: A Armin Wolf 提交者: Guenter Roeck

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: NArmin Wolf <W_Armin@gmx.de>
Acked-by: NPali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20211021190531.17379-3-W_Armin@gmx.deSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 6105870f
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/string.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -472,8 +473,7 @@ i8k_ioctl_unlocked(struct file *fp, struct dell_smm_data *data, unsigned int cmd ...@@ -472,8 +473,7 @@ i8k_ioctl_unlocked(struct file *fp, struct dell_smm_data *data, unsigned int cmd
if (restricted && !capable(CAP_SYS_ADMIN)) if (restricted && !capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
memset(buff, 0, sizeof(buff)); strscpy_pad(buff, data->bios_machineid, sizeof(buff));
strscpy(buff, data->bios_machineid, sizeof(buff));
break; break;
case I8K_FN_STATUS: case I8K_FN_STATUS:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册