Skip to content

Commit 39ab331

Browse files
geerturobherring
authored andcommitted
of/irq: Refer to actual buffer size in of_irq_parse_one()
Replace two open-coded calculations of the buffer size by invocations of sizeof() on the buffer itself, to make sure the code will always use the actual buffer size. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/817c0b9626fd30790fc488c472a3398324cfcc0c.1724156125.git.geert+renesas@glider.be Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent d6ae27b commit 39ab331

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/of/irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
357357
addr = of_get_property(device, "reg", &addr_len);
358358

359359
/* Prevent out-of-bounds read in case of longer interrupt parent address size */
360-
if (addr_len > (3 * sizeof(__be32)))
361-
addr_len = 3 * sizeof(__be32);
360+
if (addr_len > sizeof(addr_buf))
361+
addr_len = sizeof(addr_buf);
362362
if (addr)
363363
memcpy(addr_buf, addr, addr_len);
364364

0 commit comments

Comments
 (0)