From: Niklas Cassel <cassel@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v9 05/11] scsi: scsi_debug: Report the residual of a write
Date: Sun, 27 Sep 2026 09:01:20 +0200 [thread overview]
Message-ID: <ari_QAG23rIE6Ur0@ryzen> (raw)
In-Reply-To: <20260927054039.E7B7D1F000FF@smtp.kernel.org>
On Sun, Sep 27, 2026 at 05:40:39AM +0000, sashiko-bot@kernel.org wrote:
> [Severity: Medium]
> Will this calculation produce an incorrect residual if the command includes
> a very large LBA range?
>
> In resp_write_scat(), the variables num_by, num, and lb_size are all 32-bit
> integers, and num_by is calculated as:
>
> num_by = num * lb_size;
>
> If num is sufficiently large (e.g., > 8.38M blocks), does this 32-bit
> multiplication overflow and wrap around to a small value?
num_by and sg_off have been u32 since commit 481b5e5c7949 ("scsi: scsi_debug:
add resp_write_scat function").
sg_off (which can already overflow in mainline) is already passed to
do_device_access(), so this is not a new problem...
But sure... I can introduce a prep patch which changes both to u64.
Kind regards,
Niklas
next prev parent reply other threads:[~2026-09-27 7:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 5:26 [PATCH v9 00/11] scsi: scsi_debug: fix zoned write validation Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 01/11] scsi: scsi_debug: Refuse a zoned device with a non-zero lowest aligned LBA Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 02/11] scsi: scsi_debug: Make atomic writes and ZBC emulation mutually exclusive Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 03/11] scsi: scsi_debug: Take the zone metadata lock before the data lock Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 04/11] scsi: scsi_debug: Evaluate scsi_debug_lbp() only once Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 05/11] scsi: scsi_debug: Report the residual of a write Niklas Cassel
2026-09-27 5:40 ` sashiko-bot
2026-09-27 7:01 ` Niklas Cassel [this message]
2026-09-28 6:45 ` Damien Le Moal
2026-09-28 7:15 ` Niklas Cassel
2026-09-28 7:51 ` Damien Le Moal
2026-09-28 8:15 ` Damien Le Moal
2026-09-27 5:26 ` [PATCH v9 06/11] scsi: scsi_debug: Enforce physical block alignment of zoned writes Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 07/11] scsi: scsi_debug: Do not write a partial physical block to a zoned device Niklas Cassel
2026-09-27 5:26 ` [PATCH v9 08/11] scsi: scsi_debug: Advance the write pointer over the data written Niklas Cassel
2026-09-27 5:27 ` [PATCH v9 09/11] scsi: scsi_debug: Refuse a short WRITE ATOMIC (16) before writing it Niklas Cassel
2026-09-27 5:27 ` [PATCH v9 10/11] scsi: scsi_debug: Map the region written by WRITE ATOMIC (16) Niklas Cassel
2026-09-27 5:27 ` [PATCH v9 11/11] scsi: scsi_debug: Validate the access parameters of " Niklas Cassel
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=ari_QAG23rIE6Ur0@ryzen \
--to=cassel@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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