From: sashiko-bot@kernel.org
To: "Ajaykumar Rajappa" <ajaykr@linux.ibm.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v4] zfcp: Fix integer underflow in status read buffer payload length
Date: Mon, 05 Oct 2026 09:33:39 +0000 [thread overview]
Message-ID: <20261005093339.661CF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261005092357.2747395-1-ajaykr@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] scsi: zfcp: build failure due to stray non-breaking space
--
commit 2a8ab7a51f83082138fe5de204f20c12d0e7bf28
Author: Ajaykumar Rajappa <ajaykr@linux.ibm.com>
zfcp: Fix integer underflow in status read buffer payload length
This commit fixes an integer underflow in zfcp_dbf_hba_fsf_uss() and
zfcp_dbf_san_in_els() when srb->length is smaller than the fixed header
size, preventing an out-of-bounds read. It ensures payload access is skipped
if the buffer is too small, while maintaining the correct tracing semantics.
> diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
> index 81fb8af408e9c..d487e9bb15617 100644
> --- a/drivers/s390/scsi/zfcp_dbf.c
> +++ b/drivers/s390/scsi/zfcp_dbf.c
[ ... ]
> @@ -714,17 +716,34 @@ void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf)
> struct zfcp_dbf *dbf = fsf->adapter->dbf;
> struct fsf_status_read_buffer *srb =
> (struct fsf_status_read_buffer *) fsf->data;
> - u16 length;
> + u16 length, cap_length;
> struct scatterlist sg;
> + const u32 pay_offset = offsetof(struct fsf_status_read_buffer, payload);
>
> if (unlikely(!debug_level_enabled(dbf->san, ZFCP_DBF_SAN_LEVEL)))
> return;
>
> - length = (u16)(srb->length -
> - offsetof(struct fsf_status_read_buffer, payload));
> - sg_init_one(&sg, srb->payload.data, length);
> - zfcp_dbf_san(tag, dbf, "san_els", &sg, ZFCP_DBF_SAN_ELS, length,
> - fsf->req_id, ntoh24(srb->d_id), length);
> + if (srb->length < pay_offset) {
> + /*
> + * Invalid buffer: record the reported SRB length in pl_len
> + * for tracing, but capture no payload.
> + */
> + length = srb->length;
> + cap_length = 0;
> + } else {
> + /*
> + * Valid buffer: record the payload length in pl_len
> + * and capture the payload.
> + */
> + length = (u16)(srb->length - pay_offset);
> + cap_length = length;
> +
> + sg_init_one(&sg, srb->payload.data, length);
[Severity: Low]
Does this code contain a stray non-breaking space character?
The blank line right above the sg_init_one() call in zfcp_dbf_san_in_els()
contains a non-breaking space (U+00A0). This will unconditionally cause a
compiler syntax error ('stray \302\240 in program') when building the
driver.
> + }
> +
> + zfcp_dbf_san(tag, dbf, "san_els", cap_length ? &sg : NULL,
> + ZFCP_DBF_SAN_ELS, length, fsf->req_id,
> + ntoh24(srb->d_id), cap_length);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261005092357.2747395-1-ajaykr@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-10-05 9:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 9:23 [PATCH v4] zfcp: Fix integer underflow in status read buffer payload length Ajaykumar Rajappa
2026-10-05 9:33 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-10-05 9:46 Ajaykumar Rajappa
2026-10-05 9:55 ` sashiko-bot
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=20261005093339.661CF1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=ajaykr@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@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