diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 15:36:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 15:36:46 -0500 |
commit | 75b08038ceb62f3bd8935346679920f97c3cf9f6 (patch) | |
tree | 66cbc62bb569996c90877bbf010285828f669c9a /drivers/char | |
parent | fb1beb29b5c531b12485d7c32174a77120590481 (diff) | |
parent | 70fe440718d9f42bf963c2cffe12008eb5556165 (diff) |
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, mce: Clean up thermal init by introducing intel_thermal_supported()
x86, mce: Thermal monitoring depends on APIC being enabled
x86: Gart: fix breakage due to IOMMU initialization cleanup
x86: Move swiotlb initialization before dma32_free_bootmem
x86: Fix build warning in arch/x86/mm/mmio-mod.c
x86: Remove usedac in feature-removal-schedule.txt
x86: Fix duplicated UV BAU interrupt vector
nvram: Fix write beyond end condition; prove to gcc copy is safe
mm: Adjust do_pages_stat() so gcc can see copy_from_user() is safe
x86: Limit the number of processor bootup messages
x86: Remove enabling x2apic message for every CPU
doc: Add documentation for bootloader_{type,version}
x86, msr: Add support for non-contiguous cpumasks
x86: Use find_e820() instead of hard coded trampoline address
x86, AMD: Fix stale cpuid4_info shared_map data in shared_cpu_map cpumasks
Trivial percpu-naming-introduced conflicts in arch/x86/kernel/cpu/intel_cacheinfo.c
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/nvram.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 4008e2ce73c1..fdbcc9fd6d31 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -264,10 +264,16 @@ static ssize_t nvram_write(struct file *file, const char __user *buf, | |||
264 | unsigned char contents[NVRAM_BYTES]; | 264 | unsigned char contents[NVRAM_BYTES]; |
265 | unsigned i = *ppos; | 265 | unsigned i = *ppos; |
266 | unsigned char *tmp; | 266 | unsigned char *tmp; |
267 | int len; | ||
268 | 267 | ||
269 | len = (NVRAM_BYTES - i) < count ? (NVRAM_BYTES - i) : count; | 268 | if (i >= NVRAM_BYTES) |
270 | if (copy_from_user(contents, buf, len)) | 269 | return 0; /* Past EOF */ |
270 | |||
271 | if (count > NVRAM_BYTES - i) | ||
272 | count = NVRAM_BYTES - i; | ||
273 | if (count > NVRAM_BYTES) | ||
274 | return -EFAULT; /* Can't happen, but prove it to gcc */ | ||
275 | |||
276 | if (copy_from_user(contents, buf, count)) | ||
271 | return -EFAULT; | 277 | return -EFAULT; |
272 | 278 | ||
273 | spin_lock_irq(&rtc_lock); | 279 | spin_lock_irq(&rtc_lock); |
@@ -275,7 +281,7 @@ static ssize_t nvram_write(struct file *file, const char __user *buf, | |||
275 | if (!__nvram_check_checksum()) | 281 | if (!__nvram_check_checksum()) |
276 | goto checksum_err; | 282 | goto checksum_err; |
277 | 283 | ||
278 | for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp) | 284 | for (tmp = contents; count--; ++i, ++tmp) |
279 | __nvram_write_byte(*tmp, i); | 285 | __nvram_write_byte(*tmp, i); |
280 | 286 | ||
281 | __nvram_set_checksum(); | 287 | __nvram_set_checksum(); |