[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1E6549EE-799C-45ED-A9FA-B9B362F51351@intel.com>
Date: Thu, 10 Nov 2016 22:31:08 +0000
From: "Dilger, Andreas" <andreas.dilger@...el.com>
To: Colin King <colin.king@...onical.com>
CC: James Simmons <jsimmons@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Hammond, John" <john.hammond@...el.com>,
Amitoj Kaur Chawla <amitoj1606@...il.com>,
"lustre-devel@...ts.lustre.org" <lustre-devel@...ts.lustre.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: lustre: lov: Fix signed wrap around when
decrementing index 'i'
On Nov 10, 2016, at 07:19, Colin King <colin.king@...onical.com> wrote:
>
> From: Colin Ian King <colin.king@...onical.com>
>
> Change predecrement compare to post decrement compare to avoid an
> unsigned integer wrap-around comparisomn when decrementing in the while
> loop.
>
> Issue found with static analysis with CoverityScan, CID 1375917
Thanks for the patch. Seems this change has gotten a lot of attention,
this is the third patch to the list to fix it. My preference is to
undo the int->unsigned declaration change, for which James has already
submitted a patch.
Cheers, Andreas
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/staging/lustre/lustre/lov/lov_ea.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c
> index 53db170..399298c 100644
> --- a/drivers/staging/lustre/lustre/lov/lov_ea.c
> +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c
> @@ -102,7 +102,7 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count)
> return lsm;
>
> err:
> - while (--i >= 0)
> + while (i-- > 0)
> kmem_cache_free(lov_oinfo_slab, lsm->lsm_oinfo[i]);
> kvfree(lsm);
> return NULL;
> --
> 2.10.2
>
Powered by blists - more mailing lists