linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix array index out of bound exception
@ 2021-08-11 13:11 F.A. SULAIMAN
  2021-08-11 14:59 ` Jan Kara
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: F.A. SULAIMAN @ 2021-08-11 13:11 UTC (permalink / raw)
  To: jack; +Cc: F.A.Sulaiman, linux-kernel

From: "F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>

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@itfac.mrt.ac.lk>
---
 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


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

end of thread, other threads:[~2021-08-11 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 13:11 [PATCH] fix array index out of bound exception F.A. SULAIMAN
2021-08-11 14:59 ` Jan Kara
2021-08-11 16:31 ` kernel test robot
2021-08-11 17:23 ` kernel test robot
2021-08-11 17:24 ` kernel test robot

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).