[Intel-wired-lan] [PATCH net] sched/deadline: fix one-bit signed bitfields to be unsigned

Bowers, AndrewX andrewx.bowers at intel.com
Mon Nov 27 22:48:01 UTC 2017


> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Tuesday, November 21, 2017 2:31 PM
> To: Intel Wired LAN <intel-wired-lan at lists.osuosl.org>
> Cc: Peter Zijlstra <peterz at infradead.org>; luca abeni
> <luca.abeni at santannapisa.it>; Ingo Molnar <mingo at redhat.com>
> Subject: [Intel-wired-lan] [PATCH net] sched/deadline: fix one-bit signed
> bitfields to be unsigned
> 
> Commit 799ba82de01e ("sched/deadline: Use C bitfields for the state flags",
> 2017-10-10) introduced the use of C bitfields for these variables. However,
> sparse complains about them:
> 
> ./include/linux/sched.h:476:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:477:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:478:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:479:62: error: dubious one-bit signed bitfield
> 
> This is because a one-bit signed bitfield can only hold the values 0 and -1,
> which can cause problems if the program expects to be able to represent the
> value positive 1.
> 
> In practice, this may not cause a bug since -1 would be considered "true" in
> logical tests, however we should avoid the practice anyways.
> 
> Fixes: 799ba82de01e ("sched/deadline: Use C bitfields for the state flags",
> 2017-10-10)
> Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
> Cc: Ingo Molnar <mingo at redhat.com>
> Cc: Peter Zijlstra <peterz at infradead.org>
> Cc: luca abeni <luca.abeni at santannapisa.it>
> ---
>  include/linux/sched.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers at intel.com>




More information about the Intel-wired-lan mailing list