]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
lib/bitmap.c: quiet sparse noise about address space
authorH Hartley Sweeten <hartleys@visionengravers.com>
Wed, 5 Oct 2011 00:43:35 +0000 (11:43 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Oct 2011 06:06:56 +0000 (17:06 +1100)
__bitmap_parse() and __bitmap_parselist() both take a pointer to a kernel
buffer as a parameter and then cast it to a pointer to user buffer for use
in cases when the parameter is_user indicates that the buffer is actually
located in user space.  This casting, and the casts in the callers,
results in sparse noise like the following:

warning: incorrect type in initializer (different address spaces)
  expected char const [noderef] <asn:1>*ubuf
  got char const *buf
warning: cast removes address space of expression

Since these casts are intentional, use __force to quiet the noise.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/bitmap.c

index 2f4412e4d0719c25ca1d4948d489eee8c998f444..b7b71bd38028593c9c6eafecff9dc220e709b1a0 100644 (file)
@@ -419,7 +419,7 @@ int __bitmap_parse(const char *buf, unsigned int buflen,
 {
        int c, old_c, totaldigits, ndigits, nchunks, nbits;
        u32 chunk;
-       const char __user *ubuf = buf;
+       const char __user __force *ubuf = buf;
 
        bitmap_zero(maskp, nmaskbits);
 
@@ -504,7 +504,9 @@ int bitmap_parse_user(const char __user *ubuf,
 {
        if (!access_ok(VERIFY_READ, ubuf, ulen))
                return -EFAULT;
-       return __bitmap_parse((const char *)ubuf, ulen, 1, maskp, nmaskbits);
+       return __bitmap_parse((const char __force *)ubuf,
+                               ulen, 1, maskp, nmaskbits);
+
 }
 EXPORT_SYMBOL(bitmap_parse_user);
 
@@ -594,7 +596,7 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
 {
        unsigned a, b;
        int c, old_c, totaldigits;
-       const char __user *ubuf = buf;
+       const char __user __force *ubuf = buf;
        int exp_digit, in_range;
 
        totaldigits = c = 0;
@@ -694,7 +696,7 @@ int bitmap_parselist_user(const char __user *ubuf,
 {
        if (!access_ok(VERIFY_READ, ubuf, ulen))
                return -EFAULT;
-       return __bitmap_parselist((const char *)ubuf,
+       return __bitmap_parselist((const char __force *)ubuf,
                                        ulen, 1, maskp, nmaskbits);
 }
 EXPORT_SYMBOL(bitmap_parselist_user);