From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: mingo@redhat.com, peterz@infradead.org
Cc: Jacob Keller <jacob.e.keller@intel.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com,
luca abeni <luca.abeni@santannapisa.it>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [PATCH] sched/deadline: fix one-bit signed bitfields to be unsigned
Date: Tue, 28 Nov 2017 12:36:19 -0800 [thread overview]
Message-ID: <20171128203619.71430-1-jeffrey.t.kirsher@intel.com> (raw)
From: Jacob Keller <jacob.e.keller@intel.com>
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 <jacob.e.keller@intel.com>
Cc: luca abeni <luca.abeni@santannapisa.it>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
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
next reply other threads:[~2017-11-28 20:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 20:36 Jeff Kirsher [this message]
2017-11-29 4:07 ` [PATCH] sched/deadline: fix one-bit signed bitfields to be unsigned Jakub Kicinski
2017-11-30 0:12 ` Keller, Jacob E
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171128203619.71430-1-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=jacob.e.keller@intel.com \
--cc=jogreene@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=peterz@infradead.org \
--cc=sassmann@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox