Received: by 10.223.164.202 with SMTP id h10csp3903940wrb; Tue, 28 Nov 2017 20:08:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMZdou+stxNk79JNbtKXqAL41CFcIQltsCWolR/YXvpmYxeiuXWfV8mMuJd9u2BCN8/26Fxn X-Received: by 10.99.117.74 with SMTP id f10mr1490328pgn.27.1511928536445; Tue, 28 Nov 2017 20:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511928536; cv=none; d=google.com; s=arc-20160816; b=iMFqh22HE2LfyCmj6OUsdOaFHTnJKX5N2vBasjoMEyi/0XV3KTZPwEFtZBkLXJUecv FajJnj9w9ootF+wq9bMMSUsrPACSuba/rBlkX/SBKtpAKGvUGMAb4igrNQRSaxXh1mlL OwruxQxvwvyn7p6Qqd9QUMYn2+HCz88yVOU3hXbrONuhUYu+slXuPFDU36oFa/uNglXP cteIQoTePbut0x0YgEifJfrMW9GA19B9vUcpPv73doqt/lq3FvRhb/2ygG4U7NkloPUH 9dK++uYo+5BRWOF2z5O8b0Q0E7Y8DrihxSkeomFlszegzYbrmswc2NJgO6y06l91ckqp 9x+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=1mlFD8Wqy2gkYL44bsK01v4aCHZNMY+wOXeIg0bSCB4=; b=v2//698+jJKzO1pZwu6Xy3jS7tdipFnmfi4cvdZJp7CyPNTwc7MSwPQ343V7z2htjq cuV3b2MBGENzopWnXiUh8+yZJ62rJwwtHffVEBHTvtgt/MmoCGatOeJ1Qzn0+DRSR8qN s2fKPh2NY4szvmreTkv2db1v/00RrbC5sXu1P3Z1lA8bS00fL1UaMk2Nrm0l6AqPFSez 1wCswH0odGvq57o5z2B+vwjnCdNohyYWdXRPZrKdq+4QBLfzxKT3y8NS0TFxq8VqCNCu 9SVl/cOntJgltutXw/ugpCHp69LaxGoAOfnHvqJC4LJhobjMcIJPoF7DGWjXYLARmynm HTTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=CCn4yJtT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i25si612316pfa.410.2017.11.28.20.08.44; Tue, 28 Nov 2017 20:08:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=CCn4yJtT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbdK2EID (ORCPT + 71 others); Tue, 28 Nov 2017 23:08:03 -0500 Received: from mx3.wp.pl ([212.77.101.10]:40212 "EHLO mx3.wp.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822AbdK2EIC (ORCPT ); Tue, 28 Nov 2017 23:08:02 -0500 Received: (wp-smtpd smtp.wp.pl 9642 invoked from network); 29 Nov 2017 05:07:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1511928479; bh=1mlFD8Wqy2gkYL44bsK01v4aCHZNMY+wOXeIg0bSCB4=; h=From:To:Cc:Subject; b=CCn4yJtTsR+1TAlLWEm1jkai9dwJR61Stx7iC9Jhqb6RZD1NV7slP4ODK5PvU4Vzy HAZU6zH6Ezdc2UaJJ8rlUFezpWIAVaC/SxAcn1i54hhWqRtjs4YcEp1ga0T1t1vLte BECQbVy/c6JBdVstTQlUEuwcinQU+tSub6w2DixE= Received: from unknown (HELO cakuba.netronome.com) (kubakici@wp.pl@[75.53.12.129]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 29 Nov 2017 05:07:59 +0100 Date: Tue, 28 Nov 2017 20:07:53 -0800 From: Jakub Kicinski To: Jeff Kirsher Cc: mingo@redhat.com, peterz@infradead.org, Jacob Keller , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com, luca abeni Subject: Re: [PATCH] sched/deadline: fix one-bit signed bitfields to be unsigned Message-ID: <20171128200726.1c806eb7@cakuba.netronome.com> In-Reply-To: <20171128203619.71430-1-jeffrey.t.kirsher@intel.com> References: <20171128203619.71430-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-WP-MailID: df3bc4ffb9e706c847fba24ec8475c60 X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 000000A [MbOU] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Nov 2017 12:36:19 -0800, Jeff Kirsher wrote: > From: Jacob Keller > > 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 > Cc: luca abeni > Tested-by: Andrew Bowers > Signed-off-by: Jeff Kirsher This is already in Linus's tree (I've been waiting for it to land as well :)) commit aa5222e92f8000ed3c1c38dddf11c83222aadfb3 Author: Dan Carpenter Date: Fri Oct 13 10:01:22 2017 +0300 sched/deadline: Don't use dubious signed bitfields 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 Reported-by: Matthew Wilcox Reported-by: Xin Long Signed-off-by: Dan Carpenter Reviewed-by: Luca Abeni Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: kernel-janitors@vger.kernel.org Cc: luca abeni Link: http://lkml.kernel.org/r/20171013070121.dzcncojuj2f4utij@mwanda Signed-off-by: Ingo Molnar From 1585343607967539974@xxx Tue Nov 28 20:38:01 +0000 2017 X-GM-THRID: 1585343607967539974 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread