From: Zijun Hu Date: Thu, 9 Jan 2025 13:26:57 +0000 (+0800) Subject: of: property: Avoiding using uninitialized variable @imaplen in parse_interrupt_map() X-Git-Tag: v6.14-rc1~100^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f73780e772c06901e99b2ad114b7f0f3fbe73ad4;p=thirdparty%2Fkernel%2Flinux.git of: property: Avoiding using uninitialized variable @imaplen in parse_interrupt_map() parse_interrupt_map() will use uninitialized variable @imaplen if fails to get property 'interrupt-map'. Fix by using the variable after successfully getting the property. Fixes: e7985f43609c ("of: property: Fix fw_devlink handling of interrupt-map") Signed-off-by: Zijun Hu Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-6-db8a72415b8c@quicinc.com Signed-off-by: Rob Herring (Arm) --- diff --git a/drivers/of/property.c b/drivers/of/property.c index 519bf9229e613..9d8b68c72c363 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1391,9 +1391,9 @@ static struct device_node *parse_interrupt_map(struct device_node *np, addrcells = of_bus_n_addr_cells(np); imap = of_get_property(np, "interrupt-map", &imaplen); - imaplen /= sizeof(*imap); if (!imap) return NULL; + imaplen /= sizeof(*imap); imap_end = imap + imaplen;