* [patch] kfifo: __must_check helper casts everything to unsigned
@ 2010-08-13 20:59 Dan Carpenter
2010-08-13 21:35 ` Stefani Seibold
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-08-13 20:59 UTC (permalink / raw)
To: Stefani Seibold
Cc: Andrew Morton, Andi Kleen, Greg Kroah-Hartman,
Mauro Carvalho Chehab, linux-kernel, kernel-janitors
There is a new wrapper to add a __must_check to kfifo macros. The
problem is that it casts everything to unsigned. That breaks for places
that check stuff like:
if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0)
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 311f875..437cc0d 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -177,6 +177,12 @@ __kfifo_must_check_helper(unsigned int val)
return val;
}
+static inline int __must_check
+__kfifo_must_check_helper_signed(int val)
+{
+ return val;
+}
+
/**
* kfifo_initialized - Check if the fifo is initialized
* @fifo: address of the fifo to check
@@ -323,7 +329,7 @@ __kfifo_must_check_helper( \
* Return 0 if no error, otherwise an error code.
*/
#define kfifo_alloc(fifo, size, gfp_mask) \
-__kfifo_must_check_helper( \
+__kfifo_must_check_helper_signed( \
({ \
typeof(fifo + 1) __tmp = (fifo); \
struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -609,7 +615,7 @@ __kfifo_must_check_helper( \
* writer, you don't need extra locking to use these macro.
*/
#define kfifo_from_user(fifo, from, len, copied) \
-__kfifo_must_check_helper( \
+__kfifo_must_check_helper_signed( \
({ \
typeof(fifo + 1) __tmp = (fifo); \
const void __user *__from = (from); \
@@ -637,7 +643,7 @@ __kfifo_must_check_helper( \
* writer, you don't need extra locking to use these macro.
*/
#define kfifo_to_user(fifo, to, len, copied) \
-__kfifo_must_check_helper( \
+__kfifo_must_check_helper_signed( \
({ \
typeof(fifo + 1) __tmp = (fifo); \
void __user *__to = (to); \
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] kfifo: __must_check helper casts everything to unsigned
2010-08-13 20:59 [patch] kfifo: __must_check helper casts everything to unsigned Dan Carpenter
@ 2010-08-13 21:35 ` Stefani Seibold
0 siblings, 0 replies; 2+ messages in thread
From: Stefani Seibold @ 2010-08-13 21:35 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andrew Morton, Andi Kleen, Greg Kroah-Hartman,
Mauro Carvalho Chehab, linux-kernel, kernel-janitors
There is a new wrapper to add a __must_check to kfifo macros. The
problem is that it casts everything to unsigned. That breaks for places
that check stuff like:
if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0)
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Stefani Seibold <stefani@seibold.net>
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 311f875..437cc0d 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -177,6 +177,12 @@ __kfifo_must_check_helper(unsigned int val)
return val;
}
+static inline int __must_check
+__kfifo_must_check_helper_signed(int val)
+{
+ return val;
+}
+
/**
* kfifo_initialized - Check if the fifo is initialized
* @fifo: address of the fifo to check
@@ -323,7 +329,7 @@ __kfifo_must_check_helper( \
* Return 0 if no error, otherwise an error code.
*/
#define kfifo_alloc(fifo, size, gfp_mask) \
-__kfifo_must_check_helper( \
+__kfifo_must_check_helper_signed( \
({ \
typeof(fifo + 1) __tmp = (fifo); \
struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -609,7 +615,7 @@ __kfifo_must_check_helper( \
* writer, you don't need extra locking to use these macro.
*/
#define kfifo_from_user(fifo, from, len, copied) \
-__kfifo_must_check_helper( \
+__kfifo_must_check_helper_signed( \
({ \
typeof(fifo + 1) __tmp = (fifo); \
const void __user *__from = (from); \
@@ -637,7 +643,7 @@ __kfifo_must_check_helper( \
* writer, you don't need extra locking to use these macro.
*/
#define kfifo_to_user(fifo, to, len, copied) \
-__kfifo_must_check_helper( \
+__kfifo_must_check_helper_signed( \
({ \
typeof(fifo + 1) __tmp = (fifo); \
void __user *__to = (to); \
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-13 21:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 20:59 [patch] kfifo: __must_check helper casts everything to unsigned Dan Carpenter
2010-08-13 21:35 ` Stefani Seibold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox