[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e4094087-f772-466f-b0a5-11528a798ff5@acm.org>
Date: Tue, 18 Feb 2025 14:18:42 -0800
From: Bart Van Assche <bvanassche@....org>
To: Arthur Simchaev <arthur.simchaev@...disk.com>, martin.petersen@...cle.com
Cc: avri.altman@...disk.com, Avi.Shchislowski@...disk.com,
beanhuo@...ron.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v2] ufs: core: bsg: Fix memory crash in case arpmb command
failed
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.
Powered by blists - more mailing lists