Linux-ARM-Kernel Archive on lore.kernel.org
 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
  2026-03-14  7:33 ` Chen-Yu Tsai
  0 siblings, 2 replies; 4+ 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] 4+ messages in thread

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Jernej Škrabec @ 2026-03-02 18:43 UTC (permalink / raw)
  To: Chen-Yu Tsai, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel, Andrey Skvortsov
  Cc: Andrey Skvortsov

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




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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2026-03-14  7:33 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Jernej Skrabec, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel

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>


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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  2026-03-14  7:33 ` Chen-Yu Tsai
@ 2026-05-14 21:17   ` Andrey Skvortsov
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Skvortsov @ 2026-05-14 21:17 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Jernej Skrabec, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel


On 26-03-14 15:33, Chen-Yu Tsai wrote:
> 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>

Hi,

do I need to update and resend this patch?

-- 
Best regards,
Andrey Skvortsov


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

end of thread, other threads:[~2026-05-14 21:17 UTC | newest]

Thread overview: 4+ 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

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