From: Bart Van Assche <bvanassche@acm.org>
To: Arthur Simchaev <arthur.simchaev@sandisk.com>,
martin.petersen@oracle.com
Cc: avri.altman@sandisk.com, Avi.Shchislowski@sandisk.com,
beanhuo@micron.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] ufs: core: bsg: Fix memory crash in case arpmb command failed
Date: Tue, 18 Feb 2025 14:18:42 -0800 [thread overview]
Message-ID: <e4094087-f772-466f-b0a5-11528a798ff5@acm.org> (raw)
In-Reply-To: <20250218111527.246506-1-arthur.simchaev@sandisk.com>
On 2/18/25 3:15 AM, Arthur Simchaev wrote:
> diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c
> index 8d4ad0a3f2cf..a8ed9bc6e4f1 100644
> --- a/drivers/ufs/core/ufs_bsg.c
> +++ b/drivers/ufs/core/ufs_bsg.c
> @@ -194,10 +194,12 @@ static int ufs_bsg_request(struct bsg_job *job)
> ufshcd_rpm_put_sync(hba);
> kfree(buff);
> bsg_reply->result = ret;
> - job->reply_len = !rpmb ? sizeof(struct ufs_bsg_reply) : sizeof(struct ufs_rpmb_reply);
> /* complete the job here only if no error */
> - if (ret == 0)
> + if (ret == 0) {
> + job->reply_len = !rpmb ? sizeof(struct ufs_bsg_reply) :
> + sizeof(struct ufs_rpmb_reply);
> bsg_job_done(job, ret, bsg_reply->reply_payload_rcv_len);
> + }
Please make this code easier to read by changing !rpmb into rpmb and by
swapping the two sizeof() expressions.
Thanks,
Bart.
next prev parent reply other threads:[~2025-02-18 22:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 11:15 Arthur Simchaev
2025-02-18 12:31 ` Bean Huo
2025-02-18 13:08 ` Arthur Simchaev
2025-02-18 13:32 ` Bean Huo
2025-02-18 15:12 ` Arthur Simchaev
2025-02-18 20:12 ` Bean Huo
2025-02-18 22:18 ` Bart Van Assche [this message]
2025-02-20 14:11 ` Arthur Simchaev
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=e4094087-f772-466f-b0a5-11528a798ff5@acm.org \
--to=bvanassche@acm.org \
--cc=Avi.Shchislowski@sandisk.com \
--cc=arthur.simchaev@sandisk.com \
--cc=avri.altman@sandisk.com \
--cc=beanhuo@micron.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@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
all inboxes | Powered by JetHome®