Skip to contentSkip to conversation

firmware: arm_scmi: Fix signed error return values handling

PATCH Applied Sukrut Bellary 4 participants 4 messages Jul 18, 2023 – Jul 19, 2023 System control & power/management interface (SCPI/SCMI) Message Protocol drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")

---
This is based on static analysis. Compilation tested.

---
 drivers/firmware/arm_scmi/raw_mode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/firmware/arm_scmi/raw_mode.c +4 -1
index 6971dcf72fb9..0493aa3c12bf 100644
@@ -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;
Signature · 1 line
2.34.1
reviewer Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Sukrut Bellary
Quoted 9 lines · Sukrut Bellary

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")

---
This is based on static analysis. Compilation tested.
---

Hi Sukrut,

thanks for this.

Thanks,
Cristian

Applied
#3 lore raw
In reply to Sukrut Bellary
Quoted 3 lines · Sukrut Bellary

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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel