All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Abeni <luca.abeni@santannapisa.it>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] sched/deadline: Don't use dubious signed bitfields
Date: Fri, 13 Oct 2017 07:36:06 +0000	[thread overview]
Message-ID: <20171013093606.5539975f@luca> (raw)
In-Reply-To: <20171013070121.dzcncojuj2f4utij@mwanda>

Hi,

On Fri, 13 Oct 2017 10:01:22 +0300
Dan Carpenter <dan.carpenter@oracle.com> 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 <dan.carpenter@oracle.com>

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 <luca.abeni@santannapisa.it>


			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


WARNING: multiple messages have this Message-ID (diff)
From: Luca Abeni <luca.abeni@santannapisa.it>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] sched/deadline: Don't use dubious signed bitfields
Date: Fri, 13 Oct 2017 09:36:06 +0200	[thread overview]
Message-ID: <20171013093606.5539975f@luca> (raw)
In-Reply-To: <20171013070121.dzcncojuj2f4utij@mwanda>

Hi,

On Fri, 13 Oct 2017 10:01:22 +0300
Dan Carpenter <dan.carpenter@oracle.com> 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 <dan.carpenter@oracle.com>

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 <luca.abeni@santannapisa.it>


			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

  reply	other threads:[~2017-10-13  7:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  7:01 [PATCH] sched/deadline: Don't use dubious signed bitfields Dan Carpenter
2017-10-13  7:01 ` Dan Carpenter
2017-10-13  7:36 ` Luca Abeni [this message]
2017-10-13  7:36   ` Luca Abeni
2017-10-13 10:36   ` Dan Carpenter
2017-10-13 10:36     ` Dan Carpenter
2017-11-21  8:30 ` [tip:sched/urgent] " tip-bot for Dan Carpenter

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=20171013093606.5539975f@luca \
    --to=luca.abeni@santannapisa.it \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.