ChangeSet 1.1327, 2005/04/19 14:48:05+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
Remove unused VERIFY_READ and VERIFY_WRITE parameters from the
access_ok, user-space memory check macros.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
arch/x86/mm.c | 8 ++++----
arch/x86/traps.c | 8 ++++----
arch/x86/x86_32/usercopy.c | 6 +++---
arch/x86/x86_64/usercopy.c | 6 +++---
common/dom_mem_ops.c | 8 ++++----
common/grant_table.c | 4 ++--
common/multicall.c | 3 +--
common/physdev.c | 2 +-
include/asm-x86/x86_32/uaccess.h | 9 +++------
include/asm-x86/x86_64/uaccess.h | 7 ++-----
10 files changed, 27 insertions(+), 34 deletions(-)
diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-04-19 10:04:17 -04:00
+++ b/xen/arch/x86/mm.c 2005-04-19 10:04:17 -04:00
@@ -1464,7 +1464,7 @@
goto out;
}
- if ( unlikely(!array_access_ok(VERIFY_READ, uops, count, sizeof(op))) )
+ if ( unlikely(!array_access_ok(uops, count, sizeof(op))) )
{
rc = -EFAULT;
goto out;
@@ -1644,7 +1644,7 @@
unsigned long ents = op.nr_ents;
if ( ((ptr & (PAGE_SIZE-1)) != 0) ||
(ents > 8192) ||
- !array_access_ok(VERIFY_READ, ptr, ents, LDT_ENTRY_SIZE) )
+ !array_access_ok(ptr, ents, LDT_ENTRY_SIZE) )
{
okay = 0;
MEM_LOG("Bad args to SET_LDT: ptr=%p, ents=%p", ptr, ents);
@@ -1819,7 +1819,7 @@
perfc_addc(num_page_updates, count);
perfc_incr_histo(bpt_updates, count, PT_UPDATES);
- if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) )
+ if ( unlikely(!array_access_ok(ureqs, count, sizeof(req))) )
{
rc = -EFAULT;
goto out;
@@ -2591,7 +2591,7 @@
struct domain *d = current->domain;
/* Aligned access only, thank you. */
- if ( !access_ok(VERIFY_WRITE, addr, bytes) || ((addr & (bytes-1)) != 0) )
+ if ( !access_ok(addr, bytes) || ((addr & (bytes-1)) != 0) )
{
MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %p)\n",
bytes, addr);
diff -Nru a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c 2005-04-19 10:04:17 -04:00
+++ b/xen/arch/x86/traps.c 2005-04-19 10:04:17 -04:00
@@ -1105,25 +1105,25 @@
switch ( reg )
{
case 0:
- if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+ if ( !access_ok(value, sizeof(long)) )
return -EPERM;
if ( p == current )
__asm__ ( "mov %0, %%db0" : : "r" (value) );
break;
case 1:
- if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+ if ( !access_ok(value, sizeof(long)) )
return -EPERM;
if ( p == current )
__asm__ ( "mov %0, %%db1" : : "r" (value) );
break;
case 2:
- if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+ if ( !access_ok(value, sizeof(long)) )
return -EPERM;
if ( p == current )
__asm__ ( "mov %0, %%db2" : : "r" (value) );
break;
case 3:
- if ( !access_ok(VERIFY_READ, value, sizeof(long)) )
+ if ( !access_ok(value, sizeof(long)) )
return -EPERM;
if ( p == current )
__asm__ ( "mov %0, %%db3" : : "r" (value) );
diff -Nru a/xen/arch/x86/x86_32/usercopy.c b/xen/arch/x86/x86_32/usercopy.c
--- a/xen/arch/x86/x86_32/usercopy.c 2005-04-19 10:04:17 -04:00
+++ b/xen/arch/x86/x86_32/usercopy.c 2005-04-19 10:04:17 -04:00
@@ -59,7 +59,7 @@
unsigned long
clear_user(void __user *to, unsigned long n)
{
- if (access_ok(VERIFY_WRITE, to, n))
+ if (access_ok(to, n))
__do_clear_user(to, n);
return n;
}
@@ -410,7 +410,7 @@
unsigned long
copy_to_user(void __user *to, const void *from, unsigned long n)
{
- if (access_ok(VERIFY_WRITE, to, n))
+ if (access_ok(to, n))
n = __copy_to_user(to, from, n);
return n;
}
@@ -434,7 +434,7 @@
unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n)
{
- if (access_ok(VERIFY_READ, from, n))
+ if (access_ok(from, n))
n = __copy_from_user(to, from, n);
else
memset(to, 0, n);
diff -Nru a/xen/arch/x86/x86_64/usercopy.c b/xen/arch/x86/x86_64/usercopy.c
--- a/xen/arch/x86/x86_64/usercopy.c 2005-04-19 10:04:17 -04:00
+++ b/xen/arch/x86/x86_64/usercopy.c 2005-04-19 10:04:17 -04:00
@@ -127,7 +127,7 @@
unsigned long clear_user(void *to, unsigned long n)
{
- if (access_ok(VERIFY_WRITE, to, n))
+ if (access_ok(to, n))
return __clear_user(to, n);
return n;
}
@@ -148,7 +148,7 @@
unsigned long
copy_to_user(void __user *to, const void *from, unsigned n)
{
- if (access_ok(VERIFY_WRITE, to, n))
+ if (access_ok(to, n))
n = __copy_to_user(to, from, n);
return n;
}
@@ -172,7 +172,7 @@
unsigned long
copy_from_user(void *to, const void __user *from, unsigned n)
{
- if (access_ok(VERIFY_READ, from, n))
+ if (access_ok(from, n))
n = __copy_from_user(to, from, n);
else
memset(to, 0, n);
diff -Nru a/xen/common/dom_mem_ops.c b/xen/common/dom_mem_ops.c
--- a/xen/common/dom_mem_ops.c 2005-04-19 10:04:17 -04:00
+++ b/xen/common/dom_mem_ops.c 2005-04-19 10:04:17 -04:00
@@ -41,8 +41,8 @@
struct pfn_info *page;
unsigned long i;
- if ( unlikely(!array_access_ok(VERIFY_WRITE, extent_list,
- nr_extents, sizeof(*extent_list))) )
+ if ( unlikely(!array_access_ok(extent_list, nr_extents,
+ sizeof(*extent_list))) )
return start_extent;
if ( (extent_order != 0) && !IS_CAPABLE_PHYSDEV(current->domain) )
@@ -79,8 +79,8 @@
struct pfn_info *page;
unsigned long i, j, mpfn;
- if ( unlikely(!array_access_ok(VERIFY_READ, extent_list,
- nr_extents, sizeof(*extent_list))) )
+ if ( unlikely(!array_access_ok(extent_list, nr_extents,
+ sizeof(*extent_list))) )
return start_extent;
for ( i = start_extent; i < nr_extents; i++ )
diff -Nru a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c 2005-04-19 10:04:17 -04:00
+++ b/xen/common/grant_table.c 2005-04-19 10:04:17 -04:00
@@ -812,13 +812,13 @@
{
case GNTTABOP_map_grant_ref:
if ( unlikely(!array_access_ok(
- VERIFY_WRITE, uop, count, sizeof(gnttab_map_grant_ref_t))) )
+ uop, count, sizeof(gnttab_map_grant_ref_t))) )
goto out;
rc = gnttab_map_grant_ref((gnttab_map_grant_ref_t *)uop, count);
break;
case GNTTABOP_unmap_grant_ref:
if ( unlikely(!array_access_ok(
- VERIFY_WRITE, uop, count, sizeof(gnttab_unmap_grant_ref_t))) )
+ uop, count, sizeof(gnttab_unmap_grant_ref_t))) )
goto out;
rc = gnttab_unmap_grant_ref((gnttab_unmap_grant_ref_t *)uop, count);
break;
diff -Nru a/xen/common/multicall.c b/xen/common/multicall.c
--- a/xen/common/multicall.c 2005-04-19 10:04:17 -04:00
+++ b/xen/common/multicall.c 2005-04-19 10:04:17 -04:00
@@ -24,8 +24,7 @@
return -EINVAL;
}
- if ( unlikely(!array_access_ok(VERIFY_WRITE, call_list,
- nr_calls, sizeof(*call_list))) )
+ if ( unlikely(!array_access_ok(call_list, nr_calls, sizeof(*call_list))) )
{
DPRINTK("Bad memory range %p for %u*%u bytes.\n",
call_list, nr_calls, sizeof(*call_list));
diff -Nru a/xen/common/physdev.c b/xen/common/physdev.c
--- a/xen/common/physdev.c 2005-04-19 10:04:17 -04:00
+++ b/xen/common/physdev.c 2005-04-19 10:04:17 -04:00
@@ -712,7 +712,7 @@
case PHYSDEVOP_SET_IOBITMAP:
ret = -EINVAL;
- if ( !access_ok(VERIFY_READ, op.u.set_iobitmap.bitmap, IOBMP_BYTES) ||
+ if ( !access_ok(op.u.set_iobitmap.bitmap, IOBMP_BYTES) ||
(op.u.set_iobitmap.nr_ports > 65536) )
break;
ret = 0;
diff -Nru a/xen/include/asm-x86/x86_32/uaccess.h
b/xen/include/asm-x86/x86_32/uaccess.h
--- a/xen/include/asm-x86/x86_32/uaccess.h 2005-04-19 10:04:17 -04:00
+++ b/xen/include/asm-x86/x86_32/uaccess.h 2005-04-19 10:04:17 -04:00
@@ -11,9 +11,6 @@
#define __user
-#define VERIFY_READ 0
-#define VERIFY_WRITE 1
-
/*
* movsl can be slow when source and dest are not both 8-byte aligned
*/
@@ -39,10 +36,10 @@
:"1" (addr),"g" ((int)(size)),"r" (HYPERVISOR_VIRT_START)); \
flag; })
-#define access_ok(type,addr,size) (likely(__range_not_ok(addr,size) == 0))
+#define access_ok(addr,size) (likely(__range_not_ok(addr,size) == 0))
-#define array_access_ok(type,addr,count,size) \
- (likely(count < (~0UL/size)) && access_ok(type,addr,count*size))
+#define array_access_ok(addr,count,size) \
+ (likely(count < (~0UL/size)) && access_ok(addr,count*size))
extern long __get_user_bad(void);
extern void __put_user_bad(void);
diff -Nru a/xen/include/asm-x86/x86_64/uaccess.h
b/xen/include/asm-x86/x86_64/uaccess.h
--- a/xen/include/asm-x86/x86_64/uaccess.h 2005-04-19 10:04:17 -04:00
+++ b/xen/include/asm-x86/x86_64/uaccess.h 2005-04-19 10:04:17 -04:00
@@ -12,9 +12,6 @@
#define __user
-#define VERIFY_READ 0
-#define VERIFY_WRITE 1
-
/*
* Valid if in +ve half of 48-bit address space, or above Xen-reserved area.
* This is also valid for range checks (addr, addr+size). As long as the
@@ -25,9 +22,9 @@
(((unsigned long)(addr) < (1UL<<48)) || \
((unsigned long)(addr) >= HYPERVISOR_VIRT_END))
-#define access_ok(type, addr, size) (__addr_ok(addr))
+#define access_ok(addr, size) (__addr_ok(addr))
-#define array_access_ok(type,addr,count,size) (__addr_ok(addr))
+#define array_access_ok(addr, count, size) (__addr_ok(addr))
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|