Commit 96eddffb authored by Pawel Sikora's avatar Pawel Sikora Committed by Linus Torvalds

[PATCH] csum_and_copy_from_user gcc4 warning fixes

This patch kills tons of gcc4 warnings:

pointer targets in passing argument 2 of 'csum_and_copy_from_user' differ in signedness		 

From: Hirokazu Takata <takata@linux-m32r.org>

* include/asm-m32r/checksum.h: build fix

* arch/m32r/lib/csum_partial_copy.c:
  - update comment
  - cosmetic changes: change indentation
Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent df8ede40
...@@ -105,8 +105,8 @@ unsigned long do_csum_c(const unsigned char * buff, int len, unsigned int psum) ...@@ -105,8 +105,8 @@ unsigned long do_csum_c(const unsigned char * buff, int len, unsigned int psum)
extern unsigned long do_csum(const unsigned char *, long); extern unsigned long do_csum(const unsigned char *, long);
static unsigned int static unsigned int
do_csum_partial_copy_from_user (const char __user *src, char *dst, int len, do_csum_partial_copy_from_user (const unsigned char __user *src, unsigned char *dst,
unsigned int psum, int *errp) int len, unsigned int psum, int *errp)
{ {
unsigned long result; unsigned long result;
...@@ -129,8 +129,8 @@ do_csum_partial_copy_from_user (const char __user *src, char *dst, int len, ...@@ -129,8 +129,8 @@ do_csum_partial_copy_from_user (const char __user *src, char *dst, int len,
} }
unsigned int unsigned int
csum_partial_copy_from_user (const char __user *src, char *dst, int len, csum_partial_copy_from_user (const unsigned char __user *src, unsigned char *dst,
unsigned int sum, int *errp) int len, unsigned int sum, int *errp)
{ {
if (!access_ok(VERIFY_READ, src, len)) { if (!access_ok(VERIFY_READ, src, len)) {
*errp = -EFAULT; *errp = -EFAULT;
...@@ -142,7 +142,8 @@ csum_partial_copy_from_user (const char __user *src, char *dst, int len, ...@@ -142,7 +142,8 @@ csum_partial_copy_from_user (const char __user *src, char *dst, int len,
} }
unsigned int unsigned int
csum_partial_copy_nocheck(const char __user *src, char *dst, int len, unsigned int sum) csum_partial_copy_nocheck(const unsigned char __user *src, unsigned char *dst,
int len, unsigned int sum)
{ {
return do_csum_partial_copy_from_user(src, dst, len, sum, NULL); return do_csum_partial_copy_from_user(src, dst, len, sum, NULL);
} }
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
* operating system. INET is implemented using the BSD Socket * operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level. * interface as the means of communication with the user level.
* *
* MIPS specific IP/TCP/UDP checksumming routines * M32R specific IP/TCP/UDP checksumming routines
* (Some code taken from MIPS architecture)
* *
* Authors: Ralf Baechle, <ralf@waldorf-gmbh.de> * This file is subject to the terms and conditions of the GNU General Public
* Lots of code moved from tcp.c and ip.c; see those files * License. See the file "COPYING" in the main directory of this archive
* for more names. * for more details.
* *
* This program is free software; you can redistribute it and/or * Copyright (C) 1994, 1995 Waldorf Electronics GmbH
* modify it under the terms of the GNU General Public License * Copyright (C) 1998, 1999 Ralf Baechle
* as published by the Free Software Foundation; either version * Copyright (C) 2001-2005 Hiroyuki Kondo, Hirokazu Takata
* 2 of the License, or (at your option) any later version.
* *
*/ */
...@@ -27,8 +27,9 @@ ...@@ -27,8 +27,9 @@
/* /*
* Copy while checksumming, otherwise like csum_partial * Copy while checksumming, otherwise like csum_partial
*/ */
unsigned int csum_partial_copy_nocheck (const char *src, char *dst, unsigned int
int len, unsigned int sum) csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst,
int len, unsigned int sum)
{ {
sum = csum_partial(src, len, sum); sum = csum_partial(src, len, sum);
memcpy(dst, src, len); memcpy(dst, src, len);
...@@ -41,9 +42,10 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck); ...@@ -41,9 +42,10 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
* Copy from userspace and compute checksum. If we catch an exception * Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer. * then zero the rest of the buffer.
*/ */
unsigned int csum_partial_copy_from_user (const char __user *src, char *dst, unsigned int
int len, unsigned int sum, csum_partial_copy_from_user (const unsigned char __user *src,
int *err_ptr) unsigned char *dst,
int len, unsigned int sum, int *err_ptr)
{ {
int missing; int missing;
......
...@@ -134,8 +134,8 @@ EXPORT_SYMBOL(csum_partial); ...@@ -134,8 +134,8 @@ EXPORT_SYMBOL(csum_partial);
*/ */
unsigned int unsigned int
csum_partial_copy_from_user(const char *src, char *dst, int len, csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
int sum, int *csum_err) int len, int sum, int *csum_err)
{ {
/* /*
* GCC doesn't like more than 10 operands for the asm * GCC doesn't like more than 10 operands for the asm
...@@ -326,7 +326,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len, ...@@ -326,7 +326,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
*/ */
unsigned int unsigned int
csum_partial_copy_nocheck(const char *src, char *dst, int len, int sum) csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len, int sum)
{ {
unsigned long tmp1, tmp2; unsigned long tmp1, tmp2;
__asm__("movel %2,%4\n\t" __asm__("movel %2,%4\n\t"
......
...@@ -140,7 +140,8 @@ unsigned short ip_compute_csum(const unsigned char * buff, int len) ...@@ -140,7 +140,8 @@ unsigned short ip_compute_csum(const unsigned char * buff, int len)
*/ */
unsigned int unsigned int
csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err) csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
int len, int sum, int *csum_err)
{ {
if (csum_err) *csum_err = 0; if (csum_err) *csum_err = 0;
memcpy(dst, src, len); memcpy(dst, src, len);
...@@ -152,7 +153,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *c ...@@ -152,7 +153,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *c
*/ */
unsigned int unsigned int
csum_partial_copy(const char *src, char *dst, int len, int sum) csum_partial_copy(const unsigned char *src, unsigned char *dst, int len, int sum)
{ {
memcpy(dst, src, len); memcpy(dst, src, len);
return csum_partial(dst, len, sum); return csum_partial(dst, len, sum);
......
...@@ -113,7 +113,7 @@ EXPORT_SYMBOL(csum_partial); ...@@ -113,7 +113,7 @@ EXPORT_SYMBOL(csum_partial);
/* /*
* copy while checksumming, otherwise like csum_partial * copy while checksumming, otherwise like csum_partial
*/ */
unsigned int csum_partial_copy_nocheck(const char *src, char *dst, unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst,
int len, unsigned int sum) int len, unsigned int sum)
{ {
/* /*
...@@ -131,7 +131,7 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck); ...@@ -131,7 +131,7 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
* Copy from userspace and compute checksum. If we catch an exception * Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer. * then zero the rest of the buffer.
*/ */
unsigned int csum_partial_copy_from_user (const char *src, char *dst, unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst,
int len, unsigned int sum, int len, unsigned int sum,
int *err_ptr) int *err_ptr)
{ {
......
...@@ -136,7 +136,7 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum) ...@@ -136,7 +136,7 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum)
/* Copy while checksumming, otherwise like csum_partial. */ /* Copy while checksumming, otherwise like csum_partial. */
unsigned int unsigned int
csum_partial_copy(const char *src, char *dst, int len, unsigned int sum) csum_partial_copy(const unsigned char *src, unsigned char *dst, int len, unsigned int sum)
{ {
sum = csum_partial(src, len, sum); sum = csum_partial(src, len, sum);
memcpy(dst, src, len); memcpy(dst, src, len);
...@@ -147,7 +147,7 @@ csum_partial_copy(const char *src, char *dst, int len, unsigned int sum) ...@@ -147,7 +147,7 @@ csum_partial_copy(const char *src, char *dst, int len, unsigned int sum)
/* Copy from userspace and compute checksum. If we catch an exception /* Copy from userspace and compute checksum. If we catch an exception
then zero the rest of the buffer. */ then zero the rest of the buffer. */
unsigned int unsigned int
csum_partial_copy_from_user(const char *src, char *dst, int len, csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len,
unsigned int sum, int *err_ptr) unsigned int sum, int *err_ptr)
{ {
int missing; int missing;
...@@ -168,7 +168,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len, ...@@ -168,7 +168,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
/* Copy to userspace and compute checksum. */ /* Copy to userspace and compute checksum. */
unsigned int unsigned int
csum_partial_copy_to_user(const char *src, char *dst, int len, csum_partial_copy_to_user(const unsigned char *src, unsigned char *dst, int len,
unsigned int sum, int *err_ptr) unsigned int sum, int *err_ptr)
{ {
sum = csum_partial(src, len, sum); sum = csum_partial(src, len, sum);
...@@ -221,7 +221,7 @@ unsigned int csum_tcpudp_nofold(unsigned long saddr, ...@@ -221,7 +221,7 @@ unsigned int csum_tcpudp_nofold(unsigned long saddr,
// Post SIM: // Post SIM:
unsigned int unsigned int
csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum) csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len, unsigned int sum)
{ {
// unsigned dummy; // unsigned dummy;
pr_debug("csum_partial_copy_nocheck src %p dst %p len %d\n", src, dst, pr_debug("csum_partial_copy_nocheck src %p dst %p len %d\n", src, dst,
......
...@@ -31,10 +31,10 @@ unsigned int csum_partial(const unsigned char * buff, int len, ...@@ -31,10 +31,10 @@ unsigned int csum_partial(const unsigned char * buff, int len,
* better 64-bit) boundary * better 64-bit) boundary
*/ */
unsigned int csum_partial_copy_to(const char *src, char *dst, int len, unsigned int csum_partial_copy_to(const unsigned char *src, unsigned char *dst,
int sum, int *err_ptr); int len, int sum, int *err_ptr);
unsigned int csum_partial_copy_from(const char *src, char *dst, int len, unsigned int csum_partial_copy_from(const unsigned char *src, unsigned char *dst,
int sum, int *err_ptr); int len, int sum, int *err_ptr);
/* /*
* Note: when you get a NULL pointer exception here this means someone * Note: when you get a NULL pointer exception here this means someone
...@@ -45,7 +45,7 @@ unsigned int csum_partial_copy_from(const char *src, char *dst, int len, ...@@ -45,7 +45,7 @@ unsigned int csum_partial_copy_from(const char *src, char *dst, int len,
*/ */
static __inline__ static __inline__
unsigned int csum_partial_copy_nocheck(const char *src, char *dst, unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst,
int len, int sum) int len, int sum)
{ {
memcpy(dst, src, len); memcpy(dst, src, len);
...@@ -53,7 +53,7 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst, ...@@ -53,7 +53,7 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst,
} }
static __inline__ static __inline__
unsigned int csum_partial_copy_from_user(const char *src, char *dst, unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
return csum_partial_copy_from(src, dst, len, sum, err_ptr); return csum_partial_copy_from(src, dst, len, sum, err_ptr);
...@@ -67,7 +67,7 @@ unsigned int csum_partial_copy_from_user(const char *src, char *dst, ...@@ -67,7 +67,7 @@ unsigned int csum_partial_copy_from_user(const char *src, char *dst,
*/ */
#define csum_partial_copy_fromuser csum_partial_copy_from_user #define csum_partial_copy_fromuser csum_partial_copy_from_user
unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum); unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, int len, int sum);
/* /*
* This is a version of ip_compute_csum() optimized for IP headers, * This is a version of ip_compute_csum() optimized for IP headers,
...@@ -192,9 +192,9 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, ...@@ -192,9 +192,9 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
static __inline__ unsigned int csum_and_copy_to_user(const char *src, static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src,
char *dst, int len, unsigned char *dst,
int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
if (access_ok(VERIFY_WRITE, dst, len)) if (access_ok(VERIFY_WRITE, dst, len))
return(csum_partial_copy_to(src, dst, len, sum, err_ptr)); return(csum_partial_copy_to(src, dst, len, sum, err_ptr));
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
#include "linux/errno.h" #include "linux/errno.h"
#include "linux/module.h" #include "linux/module.h"
unsigned int arch_csum_partial(const char *buff, int len, int sum); unsigned int arch_csum_partial(const unsigned char *buff, int len, int sum);
unsigned int csum_partial(char *buff, int len, int sum) unsigned int csum_partial(unsigned char *buff, int len, int sum)
{ {
return arch_csum_partial(buff, len, sum); return arch_csum_partial(buff, len, sum);
} }
EXPORT_SYMBOL(csum_partial); EXPORT_SYMBOL(csum_partial);
unsigned int csum_partial_copy_to(const char *src, char __user *dst, int len, unsigned int csum_partial_copy_to(const unsigned char *src, char __user *dst,
int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
if(copy_to_user(dst, src, len)){ if(copy_to_user(dst, src, len)){
*err_ptr = -EFAULT; *err_ptr = -EFAULT;
...@@ -22,8 +22,8 @@ unsigned int csum_partial_copy_to(const char *src, char __user *dst, int len, ...@@ -22,8 +22,8 @@ unsigned int csum_partial_copy_to(const char *src, char __user *dst, int len,
return(arch_csum_partial(src, len, sum)); return(arch_csum_partial(src, len, sum));
} }
unsigned int csum_partial_copy_from(const char __user *src, char *dst, int len, unsigned int csum_partial_copy_from(const unsigned char __user *src, char *dst,
int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
if(copy_from_user(dst, src, len)){ if(copy_from_user(dst, src, len)){
*err_ptr = -EFAULT; *err_ptr = -EFAULT;
......
...@@ -121,7 +121,7 @@ EXPORT_SYMBOL(csum_partial); ...@@ -121,7 +121,7 @@ EXPORT_SYMBOL(csum_partial);
/* /*
* copy while checksumming, otherwise like csum_partial * copy while checksumming, otherwise like csum_partial
*/ */
unsigned int csum_partial_copy(const char *src, char *dst, unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst,
int len, unsigned int sum) int len, unsigned int sum)
{ {
/* /*
...@@ -138,7 +138,7 @@ unsigned int csum_partial_copy(const char *src, char *dst, ...@@ -138,7 +138,7 @@ unsigned int csum_partial_copy(const char *src, char *dst,
* Copy from userspace and compute checksum. If we catch an exception * Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer. * then zero the rest of the buffer.
*/ */
unsigned int csum_partial_copy_from_user (const char *src, char *dst, unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst,
int len, unsigned int sum, int len, unsigned int sum,
int *err_ptr) int *err_ptr)
{ {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* src and dst are best aligned to 64bits. * src and dst are best aligned to 64bits.
*/ */
unsigned int unsigned int
csum_partial_copy_from_user(const char __user *src, char *dst, csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst,
int len, unsigned int isum, int *errp) int len, unsigned int isum, int *errp)
{ {
might_sleep(); might_sleep();
...@@ -67,7 +67,7 @@ EXPORT_SYMBOL(csum_partial_copy_from_user); ...@@ -67,7 +67,7 @@ EXPORT_SYMBOL(csum_partial_copy_from_user);
* src and dst are best aligned to 64bits. * src and dst are best aligned to 64bits.
*/ */
unsigned int unsigned int
csum_partial_copy_to_user(const char *src, char __user *dst, csum_partial_copy_to_user(unsigned const char *src, unsigned char __user *dst,
int len, unsigned int isum, int *errp) int len, unsigned int isum, int *errp)
{ {
might_sleep(); might_sleep();
...@@ -105,7 +105,7 @@ EXPORT_SYMBOL(csum_partial_copy_to_user); ...@@ -105,7 +105,7 @@ EXPORT_SYMBOL(csum_partial_copy_to_user);
* Returns an 32bit unfolded checksum of the buffer. * Returns an 32bit unfolded checksum of the buffer.
*/ */
unsigned int unsigned int
csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum) csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len, unsigned int sum)
{ {
return csum_partial_copy_generic(src,dst,len,sum,NULL,NULL); return csum_partial_copy_generic(src,dst,len,sum,NULL,NULL);
} }
......
...@@ -25,8 +25,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign ...@@ -25,8 +25,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
* better 64-bit) boundary * better 64-bit) boundary
*/ */
asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsigned char *dst,
int *src_err_ptr, int *dst_err_ptr); int len, int sum, int *src_err_ptr, int *dst_err_ptr);
/* /*
* Note: when you get a NULL pointer exception here this means someone * Note: when you get a NULL pointer exception here this means someone
...@@ -36,14 +36,14 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i ...@@ -36,14 +36,14 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
* verify_area(). * verify_area().
*/ */
static __inline__ static __inline__
unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst,
int len, int sum) int len, int sum)
{ {
return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
} }
static __inline__ static __inline__
unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
might_sleep(); might_sleep();
...@@ -174,8 +174,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, ...@@ -174,8 +174,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
static __inline__ unsigned int csum_and_copy_to_user(const char *src, static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src,
char __user *dst, unsigned char __user *dst,
int len, int sum, int len, int sum,
int *err_ptr) int *err_ptr)
{ {
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
* *
* it's best to have buff aligned on a 32-bit boundary * it's best to have buff aligned on a 32-bit boundary
*/ */
asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); asmlinkage unsigned int csum_partial(const unsigned char *buff,
int len, unsigned int sum);
/* /*
* The same as csum_partial, but copies from src while it checksums. * The same as csum_partial, but copies from src while it checksums.
...@@ -39,15 +40,16 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, unsigne ...@@ -39,15 +40,16 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, unsigne
* Here even more important to align src and dst on a 32-bit (or even * Here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary * better 64-bit) boundary
*/ */
extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, extern unsigned int csum_partial_copy_nocheck(const unsigned char *src,
unsigned char *dst,
int len, unsigned int sum); int len, unsigned int sum);
/* /*
* This is a new version of the above that records errors it finds in *errp, * This is a new version of the above that records errors it finds in *errp,
* but continues and zeros thre rest of the buffer. * but continues and zeros thre rest of the buffer.
*/ */
extern unsigned int csum_partial_copy_from_user(const char __user *src, extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
char *dst, unsigned char *dst,
int len, unsigned int sum, int len, unsigned int sum,
int *err_ptr); int *err_ptr);
......
...@@ -34,15 +34,15 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); ...@@ -34,15 +34,15 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
* this is a new version of the above that records errors it finds in *errp, * this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer. * but continues and zeros the rest of the buffer.
*/ */
unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len,
unsigned int sum, int *errp); unsigned int sum, int *errp);
/* /*
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
static inline unsigned int csum_and_copy_to_user (const char *src, static inline unsigned int csum_and_copy_to_user (const unsigned char *src,
char __user *dst, unsigned char __user *dst,
int len, int sum, int len, int sum,
int *err_ptr) int *err_ptr)
{ {
...@@ -61,8 +61,8 @@ static inline unsigned int csum_and_copy_to_user (const char *src, ...@@ -61,8 +61,8 @@ static inline unsigned int csum_and_copy_to_user (const char *src,
* the same as csum_partial, but copies from user space (but on MIPS * the same as csum_partial, but copies from user space (but on MIPS
* we have just one address space, so this is identical to the above) * we have just one address space, so this is identical to the above)
*/ */
unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst,
unsigned int sum); int len, unsigned int sum);
/* /*
* Fold a partial checksum without adding pseudo headers * Fold a partial checksum without adding pseudo headers
......
...@@ -23,13 +23,15 @@ extern unsigned int csum_partial(const unsigned char *, int, unsigned int); ...@@ -23,13 +23,15 @@ extern unsigned int csum_partial(const unsigned char *, int, unsigned int);
* Here even more important to align src and dst on a 32-bit (or even * Here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary * better 64-bit) boundary
*/ */
extern unsigned int csum_partial_copy_nocheck(const char *, char *, int, unsigned int); extern unsigned int csum_partial_copy_nocheck(const unsigned char *, unsigned char *,
int, unsigned int);
/* /*
* this is a new version of the above that records errors it finds in *errp, * this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer. * but continues and zeros the rest of the buffer.
*/ */
extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *errp); extern unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
int len, unsigned int sum, int *errp);
/* /*
* Optimized for IP headers, which always checksum on 4 octet boundaries. * Optimized for IP headers, which always checksum on 4 octet boundaries.
...@@ -191,8 +193,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, ...@@ -191,8 +193,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
static __inline__ unsigned int csum_and_copy_to_user (const char *src, static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src,
char __user *dst, unsigned char __user *dst,
int len, int sum, int len, int sum,
int *err_ptr) int *err_ptr)
{ {
......
...@@ -34,8 +34,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign ...@@ -34,8 +34,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
* better 64-bit) boundary * better 64-bit) boundary
*/ */
asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsigned char *dst,
int *src_err_ptr, int *dst_err_ptr); int len, int sum, int *src_err_ptr, int *dst_err_ptr);
/* /*
* Note: when you get a NULL pointer exception here this means someone * Note: when you get a NULL pointer exception here this means someone
...@@ -45,14 +45,14 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i ...@@ -45,14 +45,14 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
* verify_area(). * verify_area().
*/ */
static __inline__ static __inline__
unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst,
int len, int sum) int len, int sum)
{ {
return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
} }
static __inline__ static __inline__
unsigned int csum_partial_copy_from_user ( const char *src, char *dst, unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL);
...@@ -200,8 +200,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, ...@@ -200,8 +200,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
static __inline__ unsigned int csum_and_copy_to_user (const char *src, static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src,
char __user *dst, unsigned char __user *dst,
int len, int sum, int len, int sum,
int *err_ptr) int *err_ptr)
{ {
......
...@@ -39,10 +39,10 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i ...@@ -39,10 +39,10 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
* better 64-bit) boundary * better 64-bit) boundary
*/ */
extern unsigned int __csum_partial_copy_sparc_generic (const char *, char *); extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *);
static inline unsigned int static inline unsigned int
csum_partial_copy_nocheck (const char *src, char *dst, int len, csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len,
unsigned int sum) unsigned int sum)
{ {
register unsigned int ret asm("o0") = (unsigned int)src; register unsigned int ret asm("o0") = (unsigned int)src;
...@@ -61,7 +61,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, ...@@ -61,7 +61,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len,
} }
static inline unsigned int static inline unsigned int
csum_partial_copy_from_user(const char *src, char *dst, int len, csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len,
unsigned int sum, int *err) unsigned int sum, int *err)
{ {
if (!access_ok (VERIFY_READ, src, len)) { if (!access_ok (VERIFY_READ, src, len)) {
...@@ -91,7 +91,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len, ...@@ -91,7 +91,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
} }
static inline unsigned int static inline unsigned int
csum_partial_copy_to_user(const char *src, char __user *dst, int len, csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, int len,
unsigned int sum, int *err) unsigned int sum, int *err)
{ {
if (!access_ok (VERIFY_WRITE, dst, len)) { if (!access_ok (VERIFY_WRITE, dst, len)) {
......
...@@ -38,10 +38,11 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i ...@@ -38,10 +38,11 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
* here even more important to align src and dst on a 32-bit (or even * here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary * better 64-bit) boundary
*/ */
extern unsigned int csum_partial_copy_sparc64(const char *src, char *dst, int len, unsigned int sum); extern unsigned int csum_partial_copy_sparc64(const unsigned char *src, unsigned char *dst,
int len, unsigned int sum);
static inline unsigned int static inline unsigned int
csum_partial_copy_nocheck (const char *src, char *dst, int len, csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len,
unsigned int sum) unsigned int sum)
{ {
int ret; int ret;
...@@ -53,7 +54,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, ...@@ -53,7 +54,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len,
} }
static inline unsigned int static inline unsigned int
csum_partial_copy_from_user(const char __user *src, char *dst, int len, csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, int len,
unsigned int sum, int *err) unsigned int sum, int *err)
{ {
__asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]" __asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]"
...@@ -66,10 +67,11 @@ csum_partial_copy_from_user(const char __user *src, char *dst, int len, ...@@ -66,10 +67,11 @@ csum_partial_copy_from_user(const char __user *src, char *dst, int len,
* Copy and checksum to user * Copy and checksum to user
*/ */
#define HAVE_CSUM_COPY_USER #define HAVE_CSUM_COPY_USER
extern unsigned int csum_partial_copy_user_sparc64(const char *src, char __user *dst, int len, unsigned int sum); extern unsigned int csum_partial_copy_user_sparc64(const unsigned char *src, unsigned char __user *dst,
int len, unsigned int sum);
static inline unsigned int static inline unsigned int
csum_and_copy_to_user(const char *src, char __user *dst, int len, csum_and_copy_to_user(const unsigned char *src, unsigned char __user *dst, int len,
unsigned int sum, int *err) unsigned int sum, int *err)
{ {
__asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]" __asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]"
......
...@@ -133,17 +133,17 @@ extern unsigned int csum_partial(const unsigned char *buff, unsigned len, unsign ...@@ -133,17 +133,17 @@ extern unsigned int csum_partial(const unsigned char *buff, unsigned len, unsign
/* Do not call this directly. Use the wrappers below */ /* Do not call this directly. Use the wrappers below */
extern unsigned long csum_partial_copy_generic(const char *src, const char *dst, extern unsigned long csum_partial_copy_generic(const unsigned char *src, const unsigned char *dst,
unsigned len, unsigned len,
unsigned sum, unsigned sum,
int *src_err_ptr, int *dst_err_ptr); int *src_err_ptr, int *dst_err_ptr);
extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst,
int len, unsigned int isum, int *errp); int len, unsigned int isum, int *errp);
extern unsigned int csum_partial_copy_to_user(const char *src, char __user *dst, extern unsigned int csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst,
int len, unsigned int isum, int *errp); int len, unsigned int isum, int *errp);
extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len,
unsigned int sum); unsigned int sum);
/* Old names. To be removed. */ /* Old names. To be removed. */
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
static inline static inline
unsigned int csum_and_copy_from_user (const char __user *src, char *dst, unsigned int csum_and_copy_from_user (const unsigned char __user *src, unsigned char *dst,
int len, int sum, int *err_ptr) int len, int sum, int *err_ptr)
{ {
if (verify_area(VERIFY_READ, src, len) == 0) if (verify_area(VERIFY_READ, src, len) == 0)
...@@ -42,7 +42,7 @@ unsigned int csum_and_copy_from_user (const char __user *src, char *dst, ...@@ -42,7 +42,7 @@ unsigned int csum_and_copy_from_user (const char __user *src, char *dst,
#ifndef HAVE_CSUM_COPY_USER #ifndef HAVE_CSUM_COPY_USER
static __inline__ unsigned int csum_and_copy_to_user static __inline__ unsigned int csum_and_copy_to_user
(const char *src, char __user *dst, int len, unsigned int sum, int *err_ptr) (const unsigned char *src, unsigned char __user *dst, int len, unsigned int sum, int *err_ptr)
{ {
sum = csum_partial(src, len, sum); sum = csum_partial(src, len, sum);
......
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