drivers/bus/sunxi-rsb.c | 3 +++ 1 file changed, 3 insertions(+)
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
On Sun, Mar 1, 2026 at 10:50 PM Andrey Skvortsov
<andrej.skvortzov@gmail.com> wrote:
>
> 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>
Should probably have:
Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced
Serial Bus")
I will added (via b4) when applying.
Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
Dne nedelja, 1. marec 2026 ob 15:49:39 Srednjeevropski standardni čas je Andrey Skvortsov napisal(a): > 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> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej
© 2016 - 2026 Red Hat, Inc.