Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167100
b: refs/heads/master
c: 11879ba
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Oct 2, 2009
1 parent d626894 commit 108e336
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0d18b2e34bd1ad8f5bd3f3a17b5e7df132e511a9
refs/heads/master: 11879ba5d9ab8174af9b9cefbb2396a54dfbf8c1
17 changes: 12 additions & 5 deletions trunk/arch/x86/kernel/cpu/mtrr/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,24 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
unsigned long long base, size;
char *ptr;
char line[LINE_SIZE];
int length;
size_t linelen;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (!len)
return -EINVAL;

memset(line, 0, LINE_SIZE);
if (len > LINE_SIZE)
len = LINE_SIZE;
if (copy_from_user(line, buf, len - 1))

length = len;
length--;

if (length > LINE_SIZE - 1)
length = LINE_SIZE - 1;

if (length < 0)
return -EINVAL;

if (copy_from_user(line, buf, length))
return -EFAULT;

linelen = strlen(line);
Expand Down

0 comments on commit 108e336

Please sign in to comment.