Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334594
b: refs/heads/master
c: 2702b15
h: refs/heads/master
v: v3
  • Loading branch information
Kees Cook authored and Linus Torvalds committed Oct 19, 2012
1 parent 88d128b commit d27e5c2
Show file tree
Hide file tree
Showing 2 changed files with 8 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: 1d46e232f8637f31f8df2e50b27fd20d8135bd93
refs/heads/master: 2702b1526c7278c4d65d78de209a465d4de2885e
12 changes: 7 additions & 5 deletions trunk/kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,15 +1265,16 @@ DECLARE_RWSEM(uts_sem);
* Work around broken programs that cannot handle "Linux 3.0".
* Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
*/
static int override_release(char __user *release, int len)
static int override_release(char __user *release, size_t len)
{
int ret = 0;
char buf[65];

if (current->personality & UNAME26) {
char *rest = UTS_RELEASE;
const char *rest = UTS_RELEASE;
char buf[65] = { 0 };
int ndots = 0;
unsigned v;
size_t copy;

while (*rest) {
if (*rest == '.' && ++ndots >= 3)
Expand All @@ -1283,8 +1284,9 @@ static int override_release(char __user *release, int len)
rest++;
}
v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
snprintf(buf, len, "2.6.%u%s", v, rest);
ret = copy_to_user(release, buf, len);
copy = min(sizeof(buf), max_t(size_t, 1, len));
copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
ret = copy_to_user(release, buf, copy + 1);
}
return ret;
}
Expand Down

0 comments on commit d27e5c2

Please sign in to comment.