* [PATCH] firmware: arm_scmi: Fix signed error return values handling
@ 2023-07-18 8:55 Sukrut Bellary
2023-07-18 9:05 ` Dan Carpenter
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sukrut Bellary @ 2023-07-18 8:55 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi
Cc: Sukrut Bellary, Dan Carpenter, linux-arm-kernel, linux-kernel
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@linaro.org>
Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] firmware: arm_scmi: Fix signed error return values handling
2023-07-18 8:55 [PATCH] firmware: arm_scmi: Fix signed error return values handling Sukrut Bellary
@ 2023-07-18 9:05 ` Dan Carpenter
2023-07-18 9:46 ` Cristian Marussi
2023-07-19 10:00 ` Sudeep Holla
2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2023-07-18 9:05 UTC (permalink / raw)
To: Sukrut Bellary
Cc: Sudeep Holla, Cristian Marussi, linux-arm-kernel, linux-kernel
On Tue, Jul 18, 2023 at 01:55:29AM -0700, Sukrut Bellary wrote:
> 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@linaro.org>
> Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>
> ---
Thanks!
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] firmware: arm_scmi: Fix signed error return values handling
2023-07-18 8:55 [PATCH] firmware: arm_scmi: Fix signed error return values handling Sukrut Bellary
2023-07-18 9:05 ` Dan Carpenter
@ 2023-07-18 9:46 ` Cristian Marussi
2023-07-19 10:00 ` Sudeep Holla
2 siblings, 0 replies; 4+ messages in thread
From: Cristian Marussi @ 2023-07-18 9:46 UTC (permalink / raw)
To: Sukrut Bellary
Cc: Sudeep Holla, Dan Carpenter, linux-arm-kernel, linux-kernel
On Tue, Jul 18, 2023 at 01:55:29AM -0700, Sukrut Bellary wrote:
> 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@linaro.org>
> Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>
> ---
> This is based on static analysis. Compilation tested.
> ---
Hi Sukrut,
thanks for this.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Thanks,
Cristian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] firmware: arm_scmi: Fix signed error return values handling
2023-07-18 8:55 [PATCH] firmware: arm_scmi: Fix signed error return values handling Sukrut Bellary
2023-07-18 9:05 ` Dan Carpenter
2023-07-18 9:46 ` Cristian Marussi
@ 2023-07-19 10:00 ` Sudeep Holla
2 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2023-07-19 10:00 UTC (permalink / raw)
To: Cristian Marussi, Sukrut Bellary
Cc: Sudeep Holla, Dan Carpenter, linux-arm-kernel, linux-kernel
On Tue, 18 Jul 2023 01:55:29 -0700, Sukrut Bellary wrote:
> Handle signed error return values returned by simple_write_to_buffer().
> In case of an error, return the error code.
>
Applied to sudeep.holla/linux (for-next/scmi/fixes), thanks!
[1/1] firmware: arm_scmi: Fix signed error return values handling
https://git.kernel.org/sudeep.holla/c/81b233b8dd72
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-19 10:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-18 8:55 [PATCH] firmware: arm_scmi: Fix signed error return values handling Sukrut Bellary
2023-07-18 9:05 ` Dan Carpenter
2023-07-18 9:46 ` Cristian Marussi
2023-07-19 10:00 ` Sudeep Holla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).