2017-11-30 00:12:34

by Jacob Keller

[permalink] [raw]
Subject: RE: [PATCH] sched/deadline: fix one-bit signed bitfields to be unsigned

> -----Original Message-----
> From: Jakub Kicinski [mailto:[email protected]]
> Sent: Tuesday, November 28, 2017 8:08 PM
> To: Kirsher, Jeffrey T <[email protected]>
> Cc: [email protected]; [email protected]; Keller, Jacob E
> <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; luca abeni <[email protected]>
> Subject: Re: [PATCH] sched/deadline: fix one-bit signed bitfields to be unsigned
>
> On Tue, 28 Nov 2017 12:36:19 -0800, Jeff Kirsher wrote:
> > From: Jacob Keller <[email protected]>
> >
> > 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 <[email protected]>
> > Cc: luca abeni <[email protected]>
> > Tested-by: Andrew Bowers <[email protected]>
> > Signed-off-by: Jeff Kirsher <[email protected]>
>
> This is already in Linus's tree (I've been waiting for it to land as
> well :))
>

Excellent.

Regards,
Jake

From 1585371976993302527@xxx Wed Nov 29 04:08:56 +0000 2017
X-GM-THRID: 1585343607967539974
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread