Commit c812d6c1 authored by Andi Kleen's avatar Andi Kleen Committed by Andi Kleen

[PATCH] i386: Remove copy_*_user BUG_ONs for (size < 0)

access_ok checks this case anyways, no need to check twice.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent ec1180db
...@@ -716,7 +716,6 @@ do { \ ...@@ -716,7 +716,6 @@ do { \
unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long __copy_to_user_ll(void __user *to, const void *from,
unsigned long n) unsigned long n)
{ {
BUG_ON((long) n < 0);
#ifndef CONFIG_X86_WP_WORKS_OK #ifndef CONFIG_X86_WP_WORKS_OK
if (unlikely(boot_cpu_data.wp_works_ok == 0) && if (unlikely(boot_cpu_data.wp_works_ok == 0) &&
((unsigned long )to) < TASK_SIZE) { ((unsigned long )to) < TASK_SIZE) {
...@@ -785,7 +784,6 @@ EXPORT_SYMBOL(__copy_to_user_ll); ...@@ -785,7 +784,6 @@ EXPORT_SYMBOL(__copy_to_user_ll);
unsigned long __copy_from_user_ll(void *to, const void __user *from, unsigned long __copy_from_user_ll(void *to, const void __user *from,
unsigned long n) unsigned long n)
{ {
BUG_ON((long)n < 0);
if (movsl_is_ok(to, from, n)) if (movsl_is_ok(to, from, n))
__copy_user_zeroing(to, from, n); __copy_user_zeroing(to, from, n);
else else
...@@ -797,7 +795,6 @@ EXPORT_SYMBOL(__copy_from_user_ll); ...@@ -797,7 +795,6 @@ EXPORT_SYMBOL(__copy_from_user_ll);
unsigned long __copy_from_user_ll_nozero(void *to, const void __user *from, unsigned long __copy_from_user_ll_nozero(void *to, const void __user *from,
unsigned long n) unsigned long n)
{ {
BUG_ON((long)n < 0);
if (movsl_is_ok(to, from, n)) if (movsl_is_ok(to, from, n))
__copy_user(to, from, n); __copy_user(to, from, n);
else else
...@@ -810,7 +807,6 @@ EXPORT_SYMBOL(__copy_from_user_ll_nozero); ...@@ -810,7 +807,6 @@ EXPORT_SYMBOL(__copy_from_user_ll_nozero);
unsigned long __copy_from_user_ll_nocache(void *to, const void __user *from, unsigned long __copy_from_user_ll_nocache(void *to, const void __user *from,
unsigned long n) unsigned long n)
{ {
BUG_ON((long)n < 0);
#ifdef CONFIG_X86_INTEL_USERCOPY #ifdef CONFIG_X86_INTEL_USERCOPY
if ( n > 64 && cpu_has_xmm2) if ( n > 64 && cpu_has_xmm2)
n = __copy_user_zeroing_intel_nocache(to, from, n); n = __copy_user_zeroing_intel_nocache(to, from, n);
...@@ -825,7 +821,6 @@ unsigned long __copy_from_user_ll_nocache(void *to, const void __user *from, ...@@ -825,7 +821,6 @@ unsigned long __copy_from_user_ll_nocache(void *to, const void __user *from,
unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *from, unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *from,
unsigned long n) unsigned long n)
{ {
BUG_ON((long)n < 0);
#ifdef CONFIG_X86_INTEL_USERCOPY #ifdef CONFIG_X86_INTEL_USERCOPY
if ( n > 64 && cpu_has_xmm2) if ( n > 64 && cpu_has_xmm2)
n = __copy_user_intel_nocache(to, from, n); n = __copy_user_intel_nocache(to, from, n);
...@@ -853,7 +848,6 @@ unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *fr ...@@ -853,7 +848,6 @@ unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *fr
unsigned long unsigned long
copy_to_user(void __user *to, const void *from, unsigned long n) copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
BUG_ON((long) n < 0);
if (access_ok(VERIFY_WRITE, to, n)) if (access_ok(VERIFY_WRITE, to, n))
n = __copy_to_user(to, from, n); n = __copy_to_user(to, from, n);
return n; return n;
...@@ -879,7 +873,6 @@ EXPORT_SYMBOL(copy_to_user); ...@@ -879,7 +873,6 @@ EXPORT_SYMBOL(copy_to_user);
unsigned long unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n) copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
BUG_ON((long) n < 0);
if (access_ok(VERIFY_READ, from, n)) if (access_ok(VERIFY_READ, from, n))
n = __copy_from_user(to, from, n); n = __copy_from_user(to, from, n);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment