Skip to content

Commit b0c4c1d

Browse files
smaeulgregkh
authored andcommitted
bus: sunxi-rsb: Always check register address validity
[ Upstream commit 6119293 ] 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> Fixes: d787dcd ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus") Reviewed-by: Chen-Yu Tsai <wens@kernel.org> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20260301144939.1832806-1-andrej.skvortzov@gmail.com Signed-off-by: Chen-Yu Tsai <wens@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5ff037e commit b0c4c1d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/bus/sunxi-rsb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@ static int regmap_sunxi_rsb_reg_write(void *context, unsigned int reg,
447447
struct sunxi_rsb_ctx *ctx = context;
448448
struct sunxi_rsb_device *rdev = ctx->rdev;
449449

450+
if (reg > 0xff)
451+
return -EINVAL;
452+
450453
return sunxi_rsb_write(rdev->rsb, rdev->rtaddr, reg, &val, ctx->size);
451454
}
452455

0 commit comments

Comments
 (0)