mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Zheng Yu <zheng.yu@northwestern.edu>
Cc: "ghanshyam1898@gmail.com" <ghanshyam1898@gmail.com>,
	"duttaditya18@gmail.com" <duttaditya18@gmail.com>,
	"r.smirnov@omp.ru" <r.smirnov@omp.ru>,
	"jfs-discussion@lists.sourceforge.net"
	<jfs-discussion@lists.sourceforge.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] jfs: replace hardcoded magic number with DTPAGEMAXSLOT constant
Date: Wed, 17 Sep 2025 12:00:20 -0500	[thread overview]
Message-ID: <fc270ae2-3217-4364-bf74-62bbf26ff9c7@oracle.com> (raw)
In-Reply-To: <BL0PR05MB46744E1F59F1E41E2C2E014EFF25A@BL0PR05MB4674.namprd05.prod.outlook.com>

Looks good. I'll apply and test this.

I'm removing the Fixes: lines because this is cosmetic and not really a 
bug fix. There's no need to flag this for stable.

Thanks,
Shaggy

On 7/29/25 1:28PM, Zheng Yu wrote:
> Replace hardcoded value 127 with DTPAGEMAXSLOT constant in boundary
> checks within jfs_readdir() and dtReadFirst(). This improves code
> maintainability and ensures consistency with the defined maximum
> slot value.
> 
> Fixes: ca84a2c9be48 ("jfs: array-index-out-of-bounds fix in dtReadFirst")
> Fixes: 839f102efb16 ("jfs: fix array-index-out-of-bounds in jfs_readdir")
> Signed-off-by: Zheng Yu <zheng.yu@northwestern.edu>
> ---
>   fs/jfs/jfs_dtree.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
> index ab11849cf9cc..0ab83bb7bbdf 100644
> --- a/fs/jfs/jfs_dtree.c
> +++ b/fs/jfs/jfs_dtree.c
> @@ -2903,7 +2903,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
>                   stbl = DT_GETSTBL(p);
>   
>                   for (i = index; i < p->header.nextindex; i++) {
> -                       if (stbl[i] < 0 || stbl[i] > 127) {
> +                       if (stbl[i] < 0 || stbl[i] >= DTPAGEMAXSLOT) {
>                                   jfs_err("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld",
>                                           i, stbl[i], (long)ip->i_ino, (long long)bn);
>                                   free_page(dirent_buf);
> @@ -3108,7 +3108,7 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)
>                   /* get the leftmost entry */
>                   stbl = DT_GETSTBL(p);
>   
> -               if (stbl[0] < 0 || stbl[0] > 127) {
> +               if (stbl[0] < 0 || stbl[0] >= DTPAGEMAXSLOT) {
>                           DT_PUTPAGE(mp);
>                           jfs_error(ip->i_sb, "stbl[0] out of bound\n");
>                           return -EIO;
> --
> 2.43.0


      reply	other threads:[~2025-09-17 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 18:28 Zheng Yu
2025-09-17 17:00 ` Dave Kleikamp [this message]

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=fc270ae2-3217-4364-bf74-62bbf26ff9c7@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=duttaditya18@gmail.com \
    --cc=ghanshyam1898@gmail.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=r.smirnov@omp.ru \
    --cc=zheng.yu@northwestern.edu \
    /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®