All of lore.kernel.org
 help / color / mirror / Atom feed
From: scameron@beardog.cce.hp.com
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	iss_storagedev@hp.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, scameron@beardog.cce.hp.com
Subject: Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
Date: Wed, 04 Jun 2014 14:54:07 +0000	[thread overview]
Message-ID: <20140604145407.GD6970@beardog.cce.hp.com> (raw)
In-Reply-To: <1401872880-23685-7-git-send-email-Julia.Lawall@lip6.fr>

On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e1,e2,e3;
> statement S1,S2;
> @@
> 
> e1 = find_first_zero_bit(e2,e3)
> ...
> if (e1 
> - =
> + >>   e3)
> S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/scsi/hpsa.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
>  	spin_lock_irqsave(&h->lock, flags);
>  	do {
>  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> -		if (i = h->nr_cmds) {
> +		if (i >= h->nr_cmds) {
>  			spin_unlock_irqrestore(&h->lock, flags);
>  			return NULL;
>  		}

Thanks, Ack.

You can add

Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>

to this patch if you want.

You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.

-- steve


WARNING: multiple messages have this Message-ID (diff)
From: scameron@beardog.cce.hp.com
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	iss_storagedev@hp.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, scameron@beardog.cce.hp.com
Subject: Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
Date: Wed, 4 Jun 2014 09:54:07 -0500	[thread overview]
Message-ID: <20140604145407.GD6970@beardog.cce.hp.com> (raw)
In-Reply-To: <1401872880-23685-7-git-send-email-Julia.Lawall@lip6.fr>

On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e1,e2,e3;
> statement S1,S2;
> @@
> 
> e1 = find_first_zero_bit(e2,e3)
> ...
> if (e1 
> - ==
> + >=
>   e3)
> S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/scsi/hpsa.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
>  	spin_lock_irqsave(&h->lock, flags);
>  	do {
>  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> -		if (i == h->nr_cmds) {
> +		if (i >= h->nr_cmds) {
>  			spin_unlock_irqrestore(&h->lock, flags);
>  			return NULL;
>  		}

Thanks, Ack.

You can add

Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>

to this patch if you want.

You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.

-- steve


  reply	other threads:[~2014-06-04 14:54 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04  9:07 [PATCH 0/10] use safer test on the result of find_first_zero_bit Julia Lawall
2014-06-04  9:07 ` Julia Lawall
2014-06-04  9:07 ` Julia Lawall
2014-06-04  9:07 ` Julia Lawall
2014-06-04  9:07 ` [PATCH 1/10] sh: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 2/10] ath10k: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 3/10] video: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-23 11:50   ` Tomi Valkeinen
2014-06-23 11:50     ` Tomi Valkeinen
2014-06-23 14:12     ` Julia Lawall
2014-06-23 14:12       ` Julia Lawall
2014-06-24  7:56       ` Tomi Valkeinen
2014-06-24  7:56         ` Tomi Valkeinen
2014-06-04  9:07 ` [PATCH 4/10] staging: tidspbridge: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 5/10] ARC: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 6/10] hpsa: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04 14:54   ` scameron [this message]
2014-06-04 14:54     ` scameron
2014-06-04 15:06     ` Julia Lawall
2014-06-04 15:06       ` Julia Lawall
2014-06-04 15:14       ` scameron
2014-06-04 15:14         ` scameron
2014-06-04  9:07 ` [PATCH 7/10] cciss: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 8/10] s390/pci: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04 11:09   ` Sebastian Ott
2014-06-04 11:09     ` Sebastian Ott
2014-06-04  9:07 ` [PATCH 9/10] IB/qib: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04 18:41   ` Marciniszyn, Mike
2014-06-04 18:41     ` Marciniszyn, Mike
     [not found]     ` <32E1700B9017364D9B60AED9960492BC21BE92E6-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-04 19:19       ` Julia Lawall
2014-06-04 19:19         ` Julia Lawall
2014-06-04 19:19         ` Julia Lawall
     [not found]         ` <alpine.DEB.2.02.1406042118420.1977-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2014-06-04 20:03           ` Marciniszyn, Mike
2014-06-04 20:03             ` Marciniszyn, Mike
2014-06-04 20:03             ` Marciniszyn, Mike
2014-06-04  9:08 ` [PATCH 10/10] blackfin: " Julia Lawall
2014-06-04  9:08   ` Julia Lawall
2014-06-04  9:35 ` [PATCH 0/10] " Geert Uytterhoeven
2014-06-04  9:35   ` Geert Uytterhoeven
2014-06-04  9:35   ` Geert Uytterhoeven
2014-06-04  9:35   ` Geert Uytterhoeven
2014-06-04  9:38   ` Julia Lawall
2014-06-04  9:38     ` Julia Lawall
2014-06-04  9:38     ` Julia Lawall
2014-06-04  9:38     ` Julia Lawall
2014-06-04  9:38     ` Julia Lawall
2014-06-04  9:46     ` David Laight
2014-06-04  9:46       ` David Laight
2014-06-04  9:46       ` David Laight
2014-06-04  9:46       ` David Laight
2014-06-04  9:46       ` David Laight
2014-06-04  9:52       ` Julia Lawall
2014-06-04  9:52         ` Julia Lawall
2014-06-04  9:52         ` Julia Lawall
2014-06-04  9:52         ` Julia Lawall
2014-06-04 10:55         ` Geert Uytterhoeven
2014-06-04 10:55           ` Geert Uytterhoeven
2014-06-04 10:55           ` Geert Uytterhoeven
2014-06-04 10:55           ` Geert Uytterhoeven
2014-06-04 11:00           ` Julia Lawall
2014-06-04 11:00             ` Julia Lawall
2014-06-04 11:00             ` Julia Lawall
2014-06-04 11:00             ` Julia Lawall
2014-06-04 11:07             ` Geert Uytterhoeven
2014-06-04 11:07               ` Geert Uytterhoeven
2014-06-04 11:07               ` Geert Uytterhoeven
2014-06-04 11:07               ` Geert Uytterhoeven
2014-06-04 11:07               ` Geert Uytterhoeven
2014-06-04 13:12               ` Julia Lawall
2014-06-04 13:12                 ` Julia Lawall
2014-06-04 13:12                 ` Julia Lawall
2014-06-04 13:12                 ` Julia Lawall
2014-06-04 13:34                 ` David Laight
2014-06-04 13:34                   ` David Laight
2014-06-04 13:34                   ` David Laight
2014-06-04 13:34                   ` David Laight

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=20140604145407.GD6970@beardog.cce.hp.com \
    --to=scameron@beardog.cce.hp.com \
    --cc=JBottomley@parallels.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=iss_storagedev@hp.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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.