lkml.org 
[lkml]   [2017]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/deadline: Use bools for the state flags
On Tue, 21 Nov 2017, Thomas Gleixner wrote:

> > Commit
> >
> > 799ba82de01e ("sched/deadline: Use C bitfields for the state flags")
> >
> > converted state flags into one-bit signed int. Signed one-bit type can be
> > either 0 or -1, which is going to cause a problem once 1 is assigned to it
> > and then the value later tested against 1.
> >
> > The current code is okay, as all the checks are (non-)zero check, but I
> > believe that we'd rather be safe than sorry here; remove the fragility by
> > converting the state flags to bool.
> >
> > This also silences annoying sparse complaints about this very issue when
> > compiling any code that includes sched.h.
>
> What's wrong with making these bitfields 'unsigned int' ?

Surely that works as well. I chose bool as that's in line with the actual
semantics, but I can of course resend with unsigned type if that's
preferred for one reason or another.

Thanks,

--
Jiri Kosina
SUSE Labs

\
 
 \ /
  Last update: 2017-11-21 12:44    [W:0.085 / U:2.068 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site