From: Keith Busch <kbusch@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Keith Busch <kbusch@meta.com>,
linux-block@vger.kernel.org, hch@lst.de, axboe@kernel.dk,
hans.holmberg@wdc.com
Subject: Re: [PATCH] null_blk: allow byte aligned memory offsets
Date: Wed, 5 Nov 2025 11:57:27 -0700 [thread overview]
Message-ID: <aQueFx0aVSih8fN8@kbusch-mbp> (raw)
In-Reply-To: <5d3b6e33-e22d-4388-910d-d58526c6fe6b@kernel.org>
On Tue, Nov 04, 2025 at 10:48:25AM +0900, Damien Le Moal wrote:
> > if (valid_len) {
> > - err = copy_from_nullb(nullb, page, off,
> > - sector, valid_len);
> > - off += valid_len;
> > + err = copy_from_nullb(nullb, p, pos, valid_len);
>
> Not your fault, but if this fails, we will still do the nullb_fill_pattern()
> below which I do not think is correct... ? May be we should have:
>
> if (err)
> return err;
>
> here ? But not sure if we should still call flush_dcache_page() even on error
> though.
It does look odd. copy_from_nullb() only returns success though, so
maybe we just drop the return value entirely.
> > @@ -1276,25 +1275,26 @@ static blk_status_t null_handle_data_transfer(struct nullb_cmd *cmd,
> > struct nullb *nullb = cmd->nq->dev->nullb;
> > int err = 0;
> > unsigned int len;
> > - sector_t sector = blk_rq_pos(rq);
> > - unsigned int max_bytes = nr_sectors << SECTOR_SHIFT;
> > - unsigned int transferred_bytes = 0;
> > + loff_t pos = blk_rq_pos(rq) << SECTOR_SHIFT;
> > + unsigned int nr_bytes = nr_sectors << SECTOR_SHIFT;
>
> Overflow potential here ?
Should be okay: nr_sectors comes from blk_rq_sectors().
The same calculation already exist just above, I just changed the name.
Actually, I don't know why I changed it, so I'll leave it alone in the
next version.
next prev parent reply other threads:[~2025-11-05 18:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 17:28 [PATCH] null_blk: allow byte aligned memory offsets Keith Busch
2025-11-04 1:48 ` Damien Le Moal
2025-11-05 18:57 ` Keith Busch [this message]
2025-11-04 9:15 ` Hans Holmberg
2025-11-05 18:47 ` Keith Busch
2025-11-04 11:24 ` Christoph Hellwig
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=aQueFx0aVSih8fN8@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=hans.holmberg@wdc.com \
--cc=hch@lst.de \
--cc=kbusch@meta.com \
--cc=linux-block@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;
as well as URLs for NNTP newsgroup(s).