Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Colin Ian King <colin.i.king@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] jffs2: remove redundant check on outpos > pos
Date: Wed, 30 Oct 2024 10:43:19 +0300	[thread overview]
Message-ID: <a81d5fbc-e66a-4de0-a015-e9a6b73c2ed8@stanley.mountain> (raw)
In-Reply-To: <cf07a880-1429-cc75-657e-55b32841cc00@huawei.com>

On Wed, Oct 30, 2024 at 12:45:42PM +0800, Zhihao Cheng wrote:
> 在 2024/10/30 6:20, Colin Ian King 写道:
> > The check for outpos > pos is always false because outpos is zero
> > and pos is at least zero; outpos can never be greater than pos.
> > The check is redundant and can be removed.
> > 
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> > ---
> >   fs/jffs2/compr_rubin.c | 5 -----
> >   1 file changed, 5 deletions(-)
> > 
> > diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c
> > index 556de100ebd5..9854253d0108 100644
> > --- a/fs/jffs2/compr_rubin.c
> > +++ b/fs/jffs2/compr_rubin.c
> > @@ -276,11 +276,6 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
> >   	end_rubin(&rs);
> 
> Maybe this check could detect the overflow of 'pos', I guess.

"pos" is a number between 0 and 4.  It can't overflow.

regards,
dan carpenter


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2024-10-30  7:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 22:20 [PATCH] jffs2: remove redundant check on outpos > pos Colin Ian King
2024-10-30  4:45 ` Zhihao Cheng
2024-10-30  7:43   ` Dan Carpenter [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=a81d5fbc-e66a-4de0-a015-e9a6b73c2ed8@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=chengzhihao1@huawei.com \
    --cc=colin.i.king@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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