linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] partitions: aix.c: off by one bug
@ 2014-08-05  8:09 Dan Carpenter
  2014-08-05 10:10 ` Philippe De Muyter
  2014-08-05 19:13 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-08-05  8:09 UTC (permalink / raw)
  To: Jens Axboe, Philippe De Muyter
  Cc: Fabian Frederick, linux-kernel, kernel-janitors

The lvip[] array has "state->limit" elements so the condition here
should be >= instead of >.

Fixes: 6ceea22bbbc8 ('partitions: add aix lvm partition support files')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/block/partitions/aix.c b/block/partitions/aix.c
index 0a6ed54..f3ed7b2 100644
--- a/block/partitions/aix.c
+++ b/block/partitions/aix.c
@@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state)
 				continue;
 			}
 			lv_ix = be16_to_cpu(p->lv_ix) - 1;
-			if (lv_ix > state->limit) {
+			if (lv_ix >= state->limit) {
 				cur_lv_ix = -1;
 				continue;
 			}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] partitions: aix.c: off by one bug
  2014-08-05  8:09 [patch] partitions: aix.c: off by one bug Dan Carpenter
@ 2014-08-05 10:10 ` Philippe De Muyter
  2014-08-05 10:21   ` Dan Carpenter
  2014-08-05 19:13 ` Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe De Muyter @ 2014-08-05 10:10 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jens Axboe, Fabian Frederick, linux-kernel, kernel-janitors

On Tue, Aug 05, 2014 at 11:09:59AM +0300, Dan Carpenter wrote:
> The lvip[] array has "state->limit" elements so the condition here
> should be >= instead of >.
> 
> Fixes: 6ceea22bbbc8 ('partitions: add aix lvm partition support files')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/block/partitions/aix.c b/block/partitions/aix.c
> index 0a6ed54..f3ed7b2 100644
> --- a/block/partitions/aix.c
> +++ b/block/partitions/aix.c
> @@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state)
>  				continue;
>  			}
>  			lv_ix = be16_to_cpu(p->lv_ix) - 1;
> -			if (lv_ix > state->limit) {
> +			if (lv_ix >= state->limit) {
>  				cur_lv_ix = -1;
>  				continue;
>  			}

Acked-by: Philippe De Muyter <phdm@macqel.be>

Thanks

Did you encounter the bug in real life, or only by code review ?

If this has a real risk to happen, a pr_warn would be welcome.

Philippe

-- 
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] partitions: aix.c: off by one bug
  2014-08-05 10:10 ` Philippe De Muyter
@ 2014-08-05 10:21   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-08-05 10:21 UTC (permalink / raw)
  To: Philippe De Muyter
  Cc: Jens Axboe, Fabian Frederick, linux-kernel, kernel-janitors

On Tue, Aug 05, 2014 at 12:10:11PM +0200, Philippe De Muyter wrote:
> Did you encounter the bug in real life, or only by code review ?
> 
> If this has a real risk to happen, a pr_warn would be welcome.

Static analysis.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] partitions: aix.c: off by one bug
  2014-08-05  8:09 [patch] partitions: aix.c: off by one bug Dan Carpenter
  2014-08-05 10:10 ` Philippe De Muyter
@ 2014-08-05 19:13 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2014-08-05 19:13 UTC (permalink / raw)
  To: Dan Carpenter, Philippe De Muyter
  Cc: Fabian Frederick, linux-kernel, kernel-janitors

On 08/05/2014 02:09 AM, Dan Carpenter wrote:
> The lvip[] array has "state->limit" elements so the condition here
> should be >= instead of >.
> 
> Fixes: 6ceea22bbbc8 ('partitions: add aix lvm partition support files')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/block/partitions/aix.c b/block/partitions/aix.c
> index 0a6ed54..f3ed7b2 100644
> --- a/block/partitions/aix.c
> +++ b/block/partitions/aix.c
> @@ -253,7 +253,7 @@ int aix_partition(struct parsed_partitions *state)
>  				continue;
>  			}
>  			lv_ix = be16_to_cpu(p->lv_ix) - 1;
> -			if (lv_ix > state->limit) {
> +			if (lv_ix >= state->limit) {
>  				cur_lv_ix = -1;
>  				continue;
>  			}
> 

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-05 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05  8:09 [patch] partitions: aix.c: off by one bug Dan Carpenter
2014-08-05 10:10 ` Philippe De Muyter
2014-08-05 10:21   ` Dan Carpenter
2014-08-05 19:13 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).