From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 38B473126C2; Thu, 26 Feb 2026 11:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772105655; cv=none; b=qzAbZl5D6nPOHsBVMyPofT7mdofFDszc0xdHp5GmTOPGPZvN6Y28TvSjNeuEfvXAXC1YOjUbv6LL2rgJb4C+FtsKbzSNm67HeX+smPXHqFPYsFge9JqsMzh2AI+1xtg7iQr/RV4Dr/h3zGl/BQoYSKwogsvFfuucQfTS6wyZTS4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772105655; c=relaxed/simple; bh=xQtErdqfM1tqgbGWxPiSl1ULgS+xSkGWpqRmXrTTP2c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C9UFwGZ8sAl4wUCrUKATQCKrIm04LasLIordSXrLM2zuIvKZUBIsHHfqMEYvXaITuqKBtXRDpCJSrnJUpnrvh8urruCdpAQPzcyGXLP0gNb/C9wglkCVv4Grwpk/Skl4eTypXL71OoO001dX/zeO+ZalY0Q0HjvOs6zLR+d92E4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=WE+bzrYN; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WE+bzrYN" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772105652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S0H8ygH+YlO4CNCx03qcK3DVZPCm8qVQiV1k1Y2d+/k=; b=WE+bzrYNxkX7rkOvVYIotj0P/HNDg7dgr5BIyKjoWK6c/gNQyNgdKm5vkjTkfoZRMJ11uG 7YnOvlg6mRw5/v+qJxjjYm2FpSYphCBWmhfAjo9Kp1SB7EoIDR3aW2hScwzOCQc+oLE42l nXUPqt58pVi3eC52uFA6Yk2oOf9BZZA= From: Usama Arif To: Andrew Morton , david@kernel.org, lorenzo.stoakes@oracle.com, willy@infradead.org, linux-mm@kvack.org Cc: fvdl@google.com, hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev, kas@kernel.org, baohua@kernel.org, dev.jain@arm.com, baolin.wang@linux.alibaba.com, npache@redhat.com, Liam.Howlett@oracle.com, ryan.roberts@arm.com, Vlastimil Babka , lance.yang@linux.dev, linux-kernel@vger.kernel.org, kernel-team@meta.com, maddy@linux.ibm.com, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, linux-s390@vger.kernel.org, Usama Arif Subject: [RFC v2 13/21] mm: huge_mm: Make sure all split_huge_pmd calls are checked Date: Thu, 26 Feb 2026 03:23:42 -0800 Message-ID: <20260226113233.3987674-14-usama.arif@linux.dev> In-Reply-To: <20260226113233.3987674-1-usama.arif@linux.dev> References: <20260226113233.3987674-1-usama.arif@linux.dev> Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Mark __split_huge_pmd(), split_huge_pmd() and split_huge_pmd_address() with __must_check so the compiler warns if any caller ignores the return value. Not checking return value and operating on the basis that the pmd is split could result in a kernel bug. The possibility of an order-0 allocation failing for page table allocation is very low, but it should be handled correctly. Signed-off-by: Usama Arif --- include/linux/huge_mm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 207bf7cd95c78..b4c2fd4252097 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -419,7 +419,7 @@ void deferred_split_folio(struct folio *folio, bool partially_mapped); void reparent_deferred_split_queue(struct mem_cgroup *memcg); #endif -int __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, +int __must_check __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, unsigned long address, bool freeze); /** @@ -448,7 +448,7 @@ static inline bool pmd_is_huge(pmd_t pmd) return false; } -static inline int split_huge_pmd(struct vm_area_struct *vma, +static inline int __must_check split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, unsigned long address) { if (pmd_is_huge(*pmd)) @@ -456,7 +456,7 @@ static inline int split_huge_pmd(struct vm_area_struct *vma, return 0; } -int split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address, +int __must_check split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address, bool freeze); void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud, -- 2.47.3