34 lines
1.0 KiB
Diff
34 lines
1.0 KiB
Diff
|
From 2a60b41c53e7b966d1c8bc5a39efd62af099d72c Mon Sep 17 00:00:00 2001
|
||
|
From: Samuel Holland <samuel@sholland.org>
|
||
|
Date: Mon, 30 Dec 2019 21:56:59 -0600
|
||
|
Subject: [PATCH 153/389] bus: sunxi-rsb: Always check register address
|
||
|
validity
|
||
|
|
||
|
The register address was already validated for read operations 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>
|
||
|
---
|
||
|
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 3aa91aed3bf7..a3a9ed5bd3a6 100644
|
||
|
--- a/drivers/bus/sunxi-rsb.c
|
||
|
+++ b/drivers/bus/sunxi-rsb.c
|
||
|
@@ -442,6 +442,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.35.3
|
||
|
|