Re: kfifo must_check warning

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Tuesday, October 19, 2010 - 10:12 pm

On Tue, 19 Oct 2010 15:10:48 -0700 Randy Dunlap <randy.dunlap@oracle.com> wrote:


A gcc bug, I'd say.  The code looks OK and my gcc doesn't warn.

Perhaps see if you can find some code transformation in n_gsm.c which
makes it go away?  Add a new local variable or something.


I did see a probably unrelated bug in there though. 
__kfifo_must_check_helper() coerces its arg into an `unsigned int' and
returns an unsigned int.  Consequently if kfifo_alloc() tries to return
-EINVAL, the above-quoted code won't detect the error: it will see
-EINVAL as a large, positive unsigned value.

I don't see a simple fix for that apart from creating several flavours
of __kfifo_must_check_helper() and carefully going through each
instance and using the one which takes (and returns) the correct type.

A suitable temporary 2.6.37 patch would bee to just disable
__kfifo_must_check_helper():

--- a/include/linux/kfifo.h~a
+++ a/include/linux/kfifo.h
@@ -171,11 +171,7 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PT
 	}
 
 
-static inline unsigned int __must_check
-__kfifo_must_check_helper(unsigned int val)
-{
-	return val;
-}
+#define __kfifo_must_check_helper(x) (x)
 
 /**
  * kfifo_initialized - Check if the fifo is initialized
_

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
kfifo must_check warning, Randy Dunlap, (Tue Oct 19, 3:10 pm)
Re: kfifo must_check warning, Andrew Morton, (Tue Oct 19, 10:12 pm)
Re: kfifo must_check warning (+ patch), Randy Dunlap, (Wed Oct 20, 9:46 am)
Re: kfifo must_check warning (+ patch), miltonm, (Wed Oct 20, 10:51 am)
Re: kfifo must_check warning (+ patch), Alan Cox, (Wed Oct 20, 11:37 am)
Re: kfifo must_check warning (+ patch), Andrew Morton, (Wed Oct 20, 11:56 am)
Re: kfifo must_check warning (+ patch), Stefani Seibold, (Wed Oct 20, 1:09 pm)