From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754191AbdK1UhF (ORCPT ); Tue, 28 Nov 2017 15:37:05 -0500 Received: from mga05.intel.com ([192.55.52.43]:49194 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbdK1UhD (ORCPT ); Tue, 28 Nov 2017 15:37:03 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,468,1505804400"; d="scan'208";a="13060212" From: Jeff Kirsher To: mingo@redhat.com, peterz@infradead.org Cc: Jacob Keller , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com, luca abeni , Jeff Kirsher Subject: [PATCH] sched/deadline: fix one-bit signed bitfields to be unsigned Date: Tue, 28 Nov 2017 12:36:19 -0800 Message-Id: <20171128203619.71430-1-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.15.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- include/linux/sched.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index a5dc7c98b0a2..21991d668d35 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -473,10 +473,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 -- 2.15.0