Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47625
b: refs/heads/master
c: 8d06087
h: refs/heads/master
i:
  47623: 2158a61
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Feb 11, 2007
1 parent af6c0d7 commit 9d342a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 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: c75fb88dbcc470e6041a20b1457b4835b9a0a48a
refs/heads/master: 8d06087714b78e8921bd30b5c64202fe80c47339
16 changes: 12 additions & 4 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,13 +1686,12 @@ static int _proc_do_string(void* data, int maxlen, int write,
size_t len;
char __user *p;
char c;

if (!data || !maxlen || !*lenp ||
(*ppos && !write)) {

if (!data || !maxlen || !*lenp) {
*lenp = 0;
return 0;
}

if (write) {
len = 0;
p = buffer;
Expand All @@ -1713,6 +1712,15 @@ static int _proc_do_string(void* data, int maxlen, int write,
len = strlen(data);
if (len > maxlen)
len = maxlen;

if (*ppos > len) {
*lenp = 0;
return 0;
}

data += *ppos;
len -= *ppos;

if (len > *lenp)
len = *lenp;
if (len)
Expand Down

0 comments on commit 9d342a8

Please sign in to comment.