Re: [PATCH] fix array index out of bound exception

From: Jan Kara
Date: Wed Aug 11 2021 - 10:59:29 EST


On Wed 11-08-21 18:41:50, F.A. SULAIMAN wrote:
> From: "F.A.Sulaiman" <asha.16@xxxxxxxxxxxxxxx>
>
> Array index out of bound exception occurs when the 'part' variable is
> passed into the freeSpactTable array, this can be avoided using pointer
> arithmetic.
>
> Signed-off-by: F.A. SULAIMAN <asha.16@xxxxxxxxxxxxxxx>

I'm sorry but this doesn't even compile and the change is obviously
bogus...

Honza

> ---
> fs/udf/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 2f83c1204e20..d330c7162c3a 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -2522,7 +2522,7 @@ static unsigned int udf_count_free(struct super_block *sb)
> sbi->s_lvid_bh->b_data;
> if (le32_to_cpu(lvid->numOfPartitions) > part) {
> accum = le32_to_cpu(
> - lvid->freeSpaceTable[part]);
> + (lvid->freeSpaceTable + part));
> if (accum == 0xFFFFFFFF)
> accum = 0;
> }
> --
> 2.17.1
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR