From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pv50p00im-zteg10011401.me.com (pv50p00im-zteg10011401.me.com [17.58.6.41]) (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 7EB59218E80 for ; Thu, 9 Jan 2025 13:29:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736429343; cv=none; b=ATjvbMgZ3YoEPPC/Fh6DSX2B/JNhIVxkIS/iXgWNvQWbXxYhzXPubgIFsmfoQk6ApWA2e6HlvgBzLu/si4jTY/IKUAqnIsGym7yhGH3y35v4ylilyyZQgAHJfQY3oUARAGpG5c1VX74vU9BfQHqzfH+W2bsJsw+dI9etg2XhsUY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736429343; c=relaxed/simple; bh=djHI9QaNvRdvMkYQkWhpIntu1Jr72xcPcI7VXA0JBdc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=agRhpCRjnQoR6S0R35cAPlzdS9Ngh91CAoW0ON5Uk0UAFn2CEJ4fIcQPrG2mChw3SMTglUzrGGWs5tGzMfnY9OQDUPAa4BvSFYXQEE28w0sWGjVEcadEGI+7pW4GmAAeL3oBt4o7497v+ln3B77CQzzCM34YS8QjI/J+wRe1lRA= 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=wYkDvcTo; arc=none smtp.client-ip=17.58.6.41 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="wYkDvcTo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1736429342; bh=VHN2cTDwwhL4M4NNiTnqYEnr4mSRlDoOGxTUWdvBfV8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=wYkDvcTonPNAn1aINi6N306QytOZbnw3S5jdQlGv+wYihRWQYE+AAJa1UfxSV3A7p 8E1W9csatvofRSczEbJvlzkJ85p1ftCENPsuNuMajSfAX8E+r3MNC+dX++9sW03m7L ue0sDBH9rG3LG93oUoBl154WMPtRUvrK8Argok0YnuPw/ScOlMx8uQvER/Q7jeCZm5 MSRCQ8CjEc7JpzpmljwSIMy8aJzHRueLY1njPeMZlTWZNzcq8BPhdVnFE1+K9fESG2 hMr36DR68QxxB/HGmVq6X2ppceYj4dlaJpGbf/+KhfWx8bWF7QniD3YmQwj5kM1YSR EMQLsy3JhjpCg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011401.me.com (Postfix) with ESMTPSA id CDB1D34BAADA; Thu, 9 Jan 2025 13:28:55 +0000 (UTC) From: Zijun Hu Date: Thu, 09 Jan 2025 21:27:01 +0800 Subject: [PATCH v4 10/14] of: reserved-memory: Do not make kmemleak ignore freed address Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250109-of_core_fix-v4-10-db8a72415b8c@quicinc.com> References: <20250109-of_core_fix-v4-0-db8a72415b8c@quicinc.com> In-Reply-To: <20250109-of_core_fix-v4-0-db8a72415b8c@quicinc.com> To: Rob Herring , Saravana Kannan , Maxime Ripard , Robin Murphy , Grant Likely , Marc Zyngier , Andreas Herrmann , Marek Szyprowski , Catalin Marinas , Mike Rapoport , Oreoluwa Babatunde Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 3PqQJNLjIOC6dU21eIaYnHtYxDB7TCD4 X-Proofpoint-ORIG-GUID: 3PqQJNLjIOC6dU21eIaYnHtYxDB7TCD4 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-09_05,2025-01-09_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=936 clxscore=1015 malwarescore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2501090108 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu early_init_dt_alloc_reserved_memory_arch() will free address @base when suffers memblock_mark_nomap() error, but it still makes kmemleak ignore the freed address @base via kmemleak_ignore_phys(). That is unnecessary, besides, also causes unnecessary warning messages: kmemleak_ignore_phys() -> make_black_object() -> paint_ptr() -> kmemleak_warn() // warning message here. Fix by avoiding kmemleak_ignore_phys() when suffer the error. Fixes: 658aafc8139c ("memblock: exclude MEMBLOCK_NOMAP regions from kmemleak") Signed-off-by: Zijun Hu --- drivers/of/of_reserved_mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index d2753756d7c30adcbd52f57338e281c16d821488..03a8f03ed1da165d6d7bf907d931857260888225 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -52,7 +52,8 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, memblock_phys_free(base, size); } - kmemleak_ignore_phys(base); + if (!err) + kmemleak_ignore_phys(base); return err; } -- 2.34.1