All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugene Korenevsky <ekorenevsky@aliyun.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] nvme: nvme_identify_ns_descs: prevent oob
Date: Tue, 2 Dec 2025 23:30:04 +0300	[thread overview]
Message-ID: <aS9MTGx6V6VacZeH@localhost.localdomain> (raw)
In-Reply-To: <aS4yhAhZYjvHOqtD@kbusch-mbp>

> > -	for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE; pos += len) {
> > -		struct nvme_ns_id_desc *cur = data + pos;

> > +	pos = 0;
> > +	do {

> > +	} while (pos < NVME_IDENTIFY_DATA_SIZE - sizeof(*cur));

> I don't want bikeshed this, but I thought this looked better as a
> for-loop. You can just modify the continuing condition instead of
> changing the loop type to do-while.

OK, tried to make the patch as close as possible to previous code.
See v4.

Also, adding 'pos += len' to modified `for` makes the line longer
than 80 symbols. However, checkpatch.pl says it is OK. Let me know
if it should be fixed somehow (e.g. by moving 'pos += len' to the
end of loop compound statement).


  parent reply	other threads:[~2025-12-02 20:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 19:43 [PATCH v3] nvme: nvme_identify_ns_descs: prevent oob Eugene Korenevsky
2025-12-02  0:27 ` Keith Busch
2025-12-02  5:57   ` Christoph Hellwig
2025-12-02 20:30   ` Eugene Korenevsky [this message]
2025-12-02 20:34     ` Keith Busch

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=aS9MTGx6V6VacZeH@localhost.localdomain \
    --to=ekorenevsky@aliyun.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.