From: <shao.mingyin@zte.com.cn>
To: <mkp@kernel.org>, <linux-scsi@vger.kernel.org>
Cc: <James.Bottomley@HansenPartnership.com>,
<alim.akhtar@samsung.com>, <bvanassche@acm.org>,
<beanhuo@micron.com>, <stanleyjhu@google.com>,
<loberman@redhat.com>, <jmeneghi@redhat.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 1/5] scsi: ufs: drop the unreachable offset check
Date: Thu, 5 Nov 2026 19:33:33 +0800 (CST) [thread overview]
Message-ID: <20261105193333968SpAtZ8KtfXSeTZlDpuSOO@zte.com.cn> (raw)
In-Reply-To: <20261105193328462jmyNd656AIL6fPlbEJ1Ki@zte.com.cn>
From: Shao Mingyin <shao.mingyin@zte.com.cn>
ufshcd_read_desc_param() rejects param_offset >= buff_len before it
reaches the is_kmalloc block, so the repeated check there can never be
true. Keep only the memcpy().
No functional change.
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index fd52deb72d21..8f89ce52921d 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3895,14 +3895,9 @@ int ufshcd_read_desc_param(struct ufs_hba *hba,
goto out;
}
- if (is_kmalloc) {
- /* Make sure we don't copy more data than available */
- if (param_offset >= buff_len)
- ret = -EINVAL;
- else
- memcpy(param_read_buf, &desc_buf[param_offset],
- min_t(u32, param_size, buff_len - param_offset));
- }
+ if (is_kmalloc)
+ memcpy(param_read_buf, &desc_buf[param_offset],
+ min_t(u32, param_size, buff_len - param_offset));
out:
if (is_kmalloc)
kfree(desc_buf);
next prev parent reply other threads:[~2026-11-05 11:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 11:33 [PATCH 0/5] scsi: remove dead code and redundant checks shao.mingyin
2026-11-05 11:33 ` shao.mingyin [this message]
2026-11-05 17:18 ` [PATCH 1/5] scsi: ufs: drop the unreachable offset check Bart Van Assche
2026-11-05 11:33 ` [PATCH 2/5] scsi: core: drop the dead VPD size check shao.mingyin
2026-11-05 17:18 ` Bart Van Assche
2026-11-05 11:33 ` [PATCH 3/5] scsi: sd: drop the dead nr_blocks store shao.mingyin
2026-11-05 11:33 ` [PATCH 4/5] scsi: sd: drop the dead -EOVERFLOW branches shao.mingyin
2026-11-05 17:20 ` Bart Van Assche
2026-11-05 11:33 ` [PATCH 5/5] scsi: st: factor out the end-of-medium completion test shao.mingyin
2026-11-05 17:21 ` Bart Van Assche
2026-11-05 17:54 ` [PATCH 0/5] scsi: remove dead code and redundant checks Bart Van Assche
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=20261105193333968SpAtZ8KtfXSeTZlDpuSOO@zte.com.cn \
--to=shao.mingyin@zte.com.cn \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jmeneghi@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=mkp@kernel.org \
--cc=stanleyjhu@google.com \
/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
all inboxes | Powered by JetHome®