summaryrefslogtreecommitdiffstats
path: root/lib/bitmap.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2011-10-31 20:12:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 20:30:56 -0400
commitb9c321fd87b61f70888511d286500519d8b34141 (patch)
treea9b85ebc499116d3db03ab1b6a0bb858b54ed4b3 /lib/bitmap.c
parent4e101b0e6aa885f5786a058eefc1ce4b7cc7c44e (diff)
lib/bitmap.c: quiet sparse noise about address space
__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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r--lib/bitmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 2f4412e4d071..0d4a127dd9b3 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -419,7 +419,7 @@ int __bitmap_parse(const char *buf, unsigned int buflen,
419{ 419{
420 int c, old_c, totaldigits, ndigits, nchunks, nbits; 420 int c, old_c, totaldigits, ndigits, nchunks, nbits;
421 u32 chunk; 421 u32 chunk;
422 const char __user *ubuf = buf; 422 const char __user __force *ubuf = (const char __user __force *)buf;
423 423
424 bitmap_zero(maskp, nmaskbits); 424 bitmap_zero(maskp, nmaskbits);
425 425
@@ -504,7 +504,9 @@ int bitmap_parse_user(const char __user *ubuf,
504{ 504{
505 if (!access_ok(VERIFY_READ, ubuf, ulen)) 505 if (!access_ok(VERIFY_READ, ubuf, ulen))
506 return -EFAULT; 506 return -EFAULT;
507 return __bitmap_parse((const char *)ubuf, ulen, 1, maskp, nmaskbits); 507 return __bitmap_parse((const char __force *)ubuf,
508 ulen, 1, maskp, nmaskbits);
509
508} 510}
509EXPORT_SYMBOL(bitmap_parse_user); 511EXPORT_SYMBOL(bitmap_parse_user);
510 512
@@ -594,7 +596,7 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
594{ 596{
595 unsigned a, b; 597 unsigned a, b;
596 int c, old_c, totaldigits; 598 int c, old_c, totaldigits;
597 const char __user *ubuf = buf; 599 const char __user __force *ubuf = (const char __user __force *)buf;
598 int exp_digit, in_range; 600 int exp_digit, in_range;
599 601
600 totaldigits = c = 0; 602 totaldigits = c = 0;
@@ -694,7 +696,7 @@ int bitmap_parselist_user(const char __user *ubuf,
694{ 696{
695 if (!access_ok(VERIFY_READ, ubuf, ulen)) 697 if (!access_ok(VERIFY_READ, ubuf, ulen))
696 return -EFAULT; 698 return -EFAULT;
697 return __bitmap_parselist((const char *)ubuf, 699 return __bitmap_parselist((const char __force *)ubuf,
698 ulen, 1, maskp, nmaskbits); 700 ulen, 1, maskp, nmaskbits);
699} 701}
700EXPORT_SYMBOL(bitmap_parselist_user); 702EXPORT_SYMBOL(bitmap_parselist_user);