Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of/irq: Correct element count for array @dummy_imask in API of_irq_parse_raw()

Array @dummy_imask only needs MAX_PHANDLE_ARGS elements, but it actually
has (MAX_PHANDLE_ARGS + 1) elements. One extra element doesn't hurt
anything except for some stack usage.

Fix by using (MAX_PHANDLE_ARGS - 1) as max element index in initializer.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241209-of_irq_fix-v1-2-782f1419c8a1@quicinc.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Zijun Hu and committed by
Rob Herring (Arm)
3a973ce1 4bc244f6

+1 -1
+1 -1
drivers/of/irq.c
··· 170 170 struct device_node *ipar, *tnode, *old = NULL; 171 171 __be32 initial_match_array[MAX_PHANDLE_ARGS]; 172 172 const __be32 *match_array = initial_match_array; 173 - const __be32 *tmp, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) }; 173 + const __be32 *tmp, dummy_imask[] = { [0 ... (MAX_PHANDLE_ARGS - 1)] = cpu_to_be32(~0) }; 174 174 u32 intsize = 1, addrsize; 175 175 int i, rc = -EINVAL; 176 176