[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230718085529.258899-1-sukrut.bellary@linux.com>
Date: Tue, 18 Jul 2023 01:55:29 -0700
From: Sukrut Bellary <sukrut.bellary@...ux.com>
To: Sudeep Holla <sudeep.holla@....com>,
Cristian Marussi <cristian.marussi@....com>
Cc: Sukrut Bellary <sukrut.bellary@...ux.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] firmware: arm_scmi: Fix signed error return values handling
Handle signed error return values returned by simple_write_to_buffer().
In case of an error, return the error code.
Fixes: 3c3d818a9317 ("firmware: arm_scmi: Add core raw transmission support")
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Signed-off-by: Sukrut Bellary <sukrut.bellary@...ux.com>
---
This is based on static analysis. Compilation tested.
---
drivers/firmware/arm_scmi/raw_mode.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/raw_mode.c b/drivers/firmware/arm_scmi/raw_mode.c
index 6971dcf72fb9..0493aa3c12bf 100644
--- a/drivers/firmware/arm_scmi/raw_mode.c
+++ b/drivers/firmware/arm_scmi/raw_mode.c
@@ -818,10 +818,13 @@ static ssize_t scmi_dbg_raw_mode_common_write(struct file *filp,
* before sending it with a single RAW xfer.
*/
if (rd->tx_size < rd->tx_req_size) {
- size_t cnt;
+ ssize_t cnt;
cnt = simple_write_to_buffer(rd->tx.buf, rd->tx.len, ppos,
buf, count);
+ if (cnt < 0)
+ return cnt;
+
rd->tx_size += cnt;
if (cnt < count)
return cnt;
--
2.34.1
Powered by blists - more mailing lists