From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757567AbdJMIgR (ORCPT ); Fri, 13 Oct 2017 04:36:17 -0400 Received: from mail.sssup.it ([193.205.80.98]:64330 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756606AbdJMIgO (ORCPT ); Fri, 13 Oct 2017 04:36:14 -0400 X-Greylist: delayed 3601 seconds by postgrey-1.27 at vger.kernel.org; Fri, 13 Oct 2017 04:36:14 EDT Date: Fri, 13 Oct 2017 09:36:06 +0200 From: Luca Abeni To: Dan Carpenter Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] sched/deadline: Don't use dubious signed bitfields Message-ID: <20171013093606.5539975f@luca> In-Reply-To: <20171013070121.dzcncojuj2f4utij@mwanda> References: <20171013070121.dzcncojuj2f4utij@mwanda> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, 13 Oct 2017 10:01:22 +0300 Dan Carpenter wrote: > It doesn't cause a run-time bug, but these bitfields should be unsigned. > When it's signed ->dl_throttled is set to either 0 or -1, instead of > 0 and 1 as expected. The sched.h file is included into tons of places > so Sparse generates a flood of warnings like this: > > ./include/linux/sched.h:477:54: error: dubious one-bit signed bitfield > > Signed-off-by: Dan Carpenter I did not notice any issue when testing, but if "unsigned int" is the common practice for bitfields, I agree with the change. Reviewed-by: Luca Abeni Thanks, Luca > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 0f897dfc195e..105eaff8a5e7 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -474,10 +474,10 @@ struct sched_dl_entity { > * conditions between the inactive timer handler and the wakeup > * code. > */ > - int dl_throttled : 1; > - int dl_boosted : 1; > - int dl_yielded : 1; > - int dl_non_contending : 1; > + unsigned int dl_throttled : 1; > + unsigned int dl_boosted : 1; > + unsigned int dl_yielded : 1; > + unsigned int dl_non_contending : 1; > > /* > * Bandwidth enforcement timer. Each -deadline task has its