ARM Sunxi Platform Development
 help / color / mirror / Atom feed
* [PATCH] bus: sunxi-rsb: Always check register address validity
@ 2026-03-01 14:49 Andrey Skvortsov
  2026-03-02 18:43 ` Jernej Škrabec
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrey Skvortsov @ 2026-03-01 14:49 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-arm-kernel,
	linux-sunxi, linux-kernel
  Cc: Andrey Skvortsov

From: Samuel Holland <samuel@sholland.org>

The register address was already validated for read operations in
regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
have the same set of possible addresses, and the address is being truncated
from u32 to u8 here as well, so the same check is needed.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
---
 drivers/bus/sunxi-rsb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index b4f2c64ac1810..daf0ea563e477 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -445,6 +445,9 @@ static int regmap_sunxi_rsb_reg_write(void *context, unsigned int reg,
 	struct sunxi_rsb_ctx *ctx = context;
 	struct sunxi_rsb_device *rdev = ctx->rdev;
 
+	if (reg > 0xff)
+		return -EINVAL;
+
 	return sunxi_rsb_write(rdev->rsb, rdev->rtaddr, reg, &val, ctx->size);
 }
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-15  2:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01 14:49 [PATCH] bus: sunxi-rsb: Always check register address validity Andrey Skvortsov
2026-03-02 18:43 ` Jernej Škrabec
2026-03-14  7:33 ` Chen-Yu Tsai
2026-05-14 21:17   ` Andrey Skvortsov
2026-05-15  2:44     ` Chen-Yu Tsai
2026-05-15  2:45 ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox