mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "F.A. SULAIMAN" <asha.16@itfac.mrt.ac.lk>
To: jack@suse.com
Cc: "F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>, linux-kernel@vger.kernel.org
Subject: [PATCH] fix array index out of bound exception
Date: Wed, 11 Aug 2021 18:41:50 +0530	[thread overview]
Message-ID: <20210811131150.20282-1-asha.16@itfac.mrt.ac.lk> (raw)

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


             reply	other threads:[~2021-08-11 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 13:11 F.A. SULAIMAN [this message]
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

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=20210811131150.20282-1-asha.16@itfac.mrt.ac.lk \
    --to=asha.16@itfac.mrt.ac.lk \
    --cc=jack@suse.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®