mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ACPI: sysfs: use strscpy() instead of strcpy()
strcpy() is deprecated in the kernel, so use strscpy() with the compile-time known size of the trace_method_name buffer instead of it. The existing length check already rejects overlong input, so the behavior is unchanged. Signed-off-by: Ruslan Vagner <rusya92266@gmail.com> [ rjw: Changelog edits ] Link: https://patch.msgid.link/CAF9RqJ4ip_egVwRKnwn3=X-Qxuwz0u_9pNrgfujBw8RSf2DTPQ@mail.gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
fd73f4a665
commit
68a385dbe0
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/kstrtox.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
@ -181,10 +182,10 @@ static int param_set_trace_method_name(const char *val,
|
|||
|
||||
/* This is a hack. We can't kmalloc in early boot. */
|
||||
if (is_abs_path)
|
||||
strcpy(trace_method_name, val);
|
||||
strscpy(trace_method_name, val, sizeof(trace_method_name));
|
||||
else {
|
||||
trace_method_name[0] = '\\';
|
||||
strcpy(trace_method_name+1, val);
|
||||
strscpy(trace_method_name + 1, val, sizeof(trace_method_name) - 1);
|
||||
}
|
||||
|
||||
/* Restore the original tracer state */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user