mirror of
https://github.com/torvalds/linux.git
synced 2026-11-25 16:02:57 +00:00
x86/mtrr: Convert to use strncpy_from_user() helper
Replace the open coded string fetch from user-space with strncpy_from_user(). Signed-off-by: Andy Shevchenko <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Luis R. Rodriguez <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Toshi Kani <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
committed by
Ingo Molnar
parent
13a4db9d75
commit
7f8ec5a4f0
@@ -106,17 +106,9 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
|
||||
|
||||
memset(line, 0, LINE_SIZE);
|
||||
|
||||
length = len;
|
||||
length--;
|
||||
|
||||
if (length > LINE_SIZE - 1)
|
||||
length = LINE_SIZE - 1;
|
||||
|
||||
length = strncpy_from_user(line, buf, LINE_SIZE - 1);
|
||||
if (length < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(line, buf, length))
|
||||
return -EFAULT;
|
||||
return length;
|
||||
|
||||
linelen = strlen(line);
|
||||
ptr = line + linelen - 1;
|
||||
|
||||
Reference in New Issue
Block a user