Skip to contentSkip to conversation

bitmap: fix address_space conversion on __bitmap_parse

PATCH New Namhyung Kim 1 participant 1 message Aug 13, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitmap: fix address_space conversion on __bitmap_parse

buf can be a user-space pointer in case of is_user, 3rd arg, is 1. But casting to ubuf lacks required address_space notations. Add it.

---
 lib/bitmap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
lib/bitmap.c +3 -2
index ffb78c9..42205d8 100644
@@ -422,7 +422,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 *ubuf = (const char __user __force *) buf;
 
 	bitmap_zero(maskp, nmaskbits);
 
@@ -507,7 +507,8 @@ 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);
 
Signature · 1 line
1.7.0.4