diff options
| author | Geert Uytterhoeven <geert+renesas@glider.be> | 2024-08-20 14:16:53 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-10 11:57:38 +0200 |
| commit | fe2c86e1927e6f37c8b0dcca7a949349f452b611 (patch) | |
| tree | 1392ca7aeb2a1a6c3f43dc3b2714fafc2a372d7a /drivers/of | |
| parent | b511474f49588cdca355ebfce54e7eddbf7b75a5 (diff) | |
| download | linux-fe2c86e1927e6f37c8b0dcca7a949349f452b611.tar.gz linux-fe2c86e1927e6f37c8b0dcca7a949349f452b611.tar.bz2 linux-fe2c86e1927e6f37c8b0dcca7a949349f452b611.zip | |
of/irq: Refer to actual buffer size in of_irq_parse_one()
[ Upstream commit 39ab331ab5d377a18fbf5a0e0b228205edfcc7f4 ]
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 <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/817c0b9626fd30790fc488c472a3398324cfcc0c.1724156125.git.geert+renesas@glider.be
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/irq.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 8fd63100ba8f..d67b69cb84bf 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -357,8 +357,8 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar addr = of_get_property(device, "reg", &addr_len); /* Prevent out-of-bounds read in case of longer interrupt parent address size */ - if (addr_len > (3 * sizeof(__be32))) - addr_len = 3 * sizeof(__be32); + if (addr_len > sizeof(addr_buf)) + addr_len = sizeof(addr_buf); if (addr) memcpy(addr_buf, addr, addr_len); |
