diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2012-10-25 09:47:19 -0400 |
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2012-10-25 09:47:35 -0400 |
| commit | 2adca5672ffe3121bbb3bd061af9f047e0f8023f (patch) | |
| tree | 01825a2f14c8d640509c39967ff9d461eaacea2f /kernel/sys.c | |
| parent | b6442559952ccd931415923b4a5866f5c0e7e781 (diff) | |
| parent | 08d04a135a1c2e24c4d4bc7bbafee5e0e58f80c6 (diff) | |
Merge tag 'at91-fixes' of git://github.com/at91linux/linux-at91 into fixes
From Nicolas Ferre <nicolas.ferre@atmel.com>:
A mix of typos and critical fixes.
The most important ones are a duplicated definition of a Kconfig
variable and the handling of external interrupts for non-DT case.
The new at91sam9g10 was suffering a recognition issue due to an ID
mis-interpreted: this was leading to a kernel panic.
* tag 'at91-fixes' of git://github.com/at91linux/linux-at91: (257 commits)
ARM: at91: drop duplicated config SOC_AT91SAM9 entry
ARM: at91/i2c: change id to let i2c-at91 work
ARM: at91/i2c: change id to let i2c-gpio work
ARM: at91/dts: at91sam9g20ek_common: Fix typos in buttons labels.
ARM: at91: fix external interrupt specification in board code
ARM: at91: fix external interrupts in non-DT case
ARM: at91: at91sam9g10: fix SOC type detection
ARM: at91/tc: fix typo in the DT document
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'kernel/sys.c')
| -rw-r--r-- | kernel/sys.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index c5cb5b99cb81..e6e0ece5f6a0 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1265,15 +1265,16 @@ DECLARE_RWSEM(uts_sem); | |||
| 1265 | * Work around broken programs that cannot handle "Linux 3.0". | 1265 | * Work around broken programs that cannot handle "Linux 3.0". |
| 1266 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 | 1266 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 |
| 1267 | */ | 1267 | */ |
| 1268 | static int override_release(char __user *release, int len) | 1268 | static int override_release(char __user *release, size_t len) |
| 1269 | { | 1269 | { |
| 1270 | int ret = 0; | 1270 | int ret = 0; |
| 1271 | char buf[65]; | ||
| 1272 | 1271 | ||
| 1273 | if (current->personality & UNAME26) { | 1272 | if (current->personality & UNAME26) { |
| 1274 | char *rest = UTS_RELEASE; | 1273 | const char *rest = UTS_RELEASE; |
| 1274 | char buf[65] = { 0 }; | ||
| 1275 | int ndots = 0; | 1275 | int ndots = 0; |
| 1276 | unsigned v; | 1276 | unsigned v; |
| 1277 | size_t copy; | ||
| 1277 | 1278 | ||
| 1278 | while (*rest) { | 1279 | while (*rest) { |
| 1279 | if (*rest == '.' && ++ndots >= 3) | 1280 | if (*rest == '.' && ++ndots >= 3) |
| @@ -1283,8 +1284,9 @@ static int override_release(char __user *release, int len) | |||
| 1283 | rest++; | 1284 | rest++; |
| 1284 | } | 1285 | } |
| 1285 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; | 1286 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; |
| 1286 | snprintf(buf, len, "2.6.%u%s", v, rest); | 1287 | copy = clamp_t(size_t, len, 1, sizeof(buf)); |
| 1287 | ret = copy_to_user(release, buf, len); | 1288 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); |
| 1289 | ret = copy_to_user(release, buf, copy + 1); | ||
| 1288 | } | 1290 | } |
| 1289 | return ret; | 1291 | return ret; |
| 1290 | } | 1292 | } |
