From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mr85p00im-hyfv06011401.me.com (mr85p00im-hyfv06011401.me.com [17.58.23.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBB9D215F5A for ; Fri, 10 Jan 2025 22:34:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.23.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736548473; cv=none; b=XmIvUERorEP2EN9RS2oflZUkfJBXDGbhXMn4XMTFBOEc/RW6HV6tX6JwdWXCaM7Obr5qFoCO6GtrKmU/mBo7JHLuZu/fWKv4UF5AdMGg5k2Jq4961kf2zLmkD6MDY59BMkGfMUGjHhpN/ZR4D6R2HVaXi5bC5s4odPLRRIH9rbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736548473; c=relaxed/simple; bh=NyT/TlNP+fecD/ylGy1NfPDaaofw/fWhiFKIdTZaCfY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aJw/wOM5MBmHnBKKis0YVvWDMRynwit5w/NlKTuKgfuKr7FHUYNRqkCHAQfQMAz+AQrNhIOJfvm7aPeL9QospadiK7A/lm5hZVOpxgwBpeDmL7sTw2ihXZ1H74Qw/XwLCZ8Ej5cLKDdWm9TBj4QRulV53g4a9noZl4ViRXebEuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=fbqKdkfY; arc=none smtp.client-ip=17.58.23.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="fbqKdkfY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1736548471; bh=wHy6Zon4xDwDb200OfbfzqcvdhouDGirFCJvj9qv2tw=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type: x-icloud-hme; b=fbqKdkfY/rV8gSHGBdr0TlCUWkzLRvj5B1m7GDgE3a1IHEs+tc6TxdTTbXdzdgeID I1Vnb/t1JJM04Lp+txJaqJC0rxn8eU58JnLbIILa1jxWZIH5hfnExYx4ghgprwAt8S Uxcfa+oR2HJiszWwY+LDl4ulB4JjkU/4+fkZ/MUiLxuObP48qCqzii0v+IEUb8JUaO 2qzM8QbBH0v5RtrBLzOFwAn1YSkBWnoqpp86NsxGznPynHCXqE8h7lXP5ZpjlYnhaX SgeQc20dO79ZmIWl092ZB3EYizb5+QpZnqcwS8GFGWLlyTLjvGIh3B7yixEjVRXI9Z sI5mSkrxFjmMw== Received: from [192.168.1.25] (mr38p00im-dlb-asmtp-mailmevip.me.com [17.57.152.18]) by mr85p00im-hyfv06011401.me.com (Postfix) with ESMTPSA id D22DC357B028; Fri, 10 Jan 2025 22:34:26 +0000 (UTC) Message-ID: Date: Sat, 11 Jan 2025 06:34:21 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 06/14] of: property: Avoiding using uninitialized variable @imaplen in parse_interrupt_map() To: Rob Herring Cc: Saravana Kannan , Maxime Ripard , Robin Murphy , Grant Likely , Marc Zyngier , Andreas Herrmann , Marek Szyprowski , Catalin Marinas , Mike Rapoport , Oreoluwa Babatunde , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu References: <20250109-of_core_fix-v4-0-db8a72415b8c@quicinc.com> <20250109-of_core_fix-v4-6-db8a72415b8c@quicinc.com> <20250110202649.GA3227291-robh@kernel.org> Content-Language: en-US From: Zijun Hu In-Reply-To: <20250110202649.GA3227291-robh@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: 1IiCdYC92CucYCalf19-LrsRuOsRlUbF X-Proofpoint-ORIG-GUID: 1IiCdYC92CucYCalf19-LrsRuOsRlUbF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-10_09,2025-01-10_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 clxscore=1015 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2501100174 On 2025/1/11 04:26, Rob Herring wrote: > On Thu, Jan 09, 2025 at 09:26:57PM +0800, Zijun Hu wrote: >> From: Zijun Hu >> >> 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 >> --- >> drivers/of/property.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/of/property.c b/drivers/of/property.c >> index dca1a3ebccae1093b2b11f51e8e692bca854d0e3..6245cbff3527d762c16e7f4b7b7b3d4f2e9ddbe6 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); > > sizeof() is a compile time constant, there's not an actual dereference > here. > the uninitialized variable is @imaplen, and not sizeof(*imap). >> >> imap_end = imap + imaplen; >> >> >> -- >> 2.34.1 >>