From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756659AbdJMKhe (ORCPT ); Fri, 13 Oct 2017 06:37:34 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:46359 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564AbdJMKhc (ORCPT ); Fri, 13 Oct 2017 06:37:32 -0400 Date: Fri, 13 Oct 2017 13:36:51 +0300 From: Dan Carpenter To: Luca Abeni 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: <20171013103651.whci6ns6dxnyddnw@mwanda> References: <20171013070121.dzcncojuj2f4utij@mwanda> <20171013093606.5539975f@luca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171013093606.5539975f@luca> User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 13, 2017 at 09:36:06AM +0200, Luca Abeni wrote: > 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 Correct. It would only cause a bug if we had a condition like: if (foo->dl_throttled == 1) { That would be impossible because ->dl_throttled == -1, but since the conditions are all in the form: if (foo->dl_throttled) { Then that works for both 1 and -1. regards, dan carpenter