From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 8A8E63290D2 for ; Fri, 27 Mar 2026 02:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774577751; cv=none; b=hSsknmg+Z8qLZ37XvSU79K1fZYEZYaIB64s2EWDq4ZGKQjDkh3WsF+9Hg5skGE1zK2/gTBxSWt4kLtZH/HdD+4Z73buj3k+uzGiRAIs73J8eAjQ8WMYhtuz3dJW8+9ap0r0idYBQlPhuoZ7+qBicF/zqjgQTXZBCQVvmOGuxfbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774577751; c=relaxed/simple; bh=j9LGkm9AT1SVnMNzLezcvHWm8GVx3wLShAsc0rRNvYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dt8zz9OX/cO9lh1gTBrUYtN5AZ8DTjFXCG/2DZhCaZ3sIkC1KxRWIkiJefxlouSAmgoySk2TcwtSUo0qO6pV1Qum+ayKb2GHJ2NrQ/KDtYEKEJe3wFR0Oo5BLvhgAdDfc5AcIy6PWNXKgZPoYe5IhO2VGD8j+yI5msdKQGyMugg= 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=PBqsuNks; arc=none smtp.client-ip=91.218.175.184 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="PBqsuNks" 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=1774577748; 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=Y5PgiQrcwbn9XAgL4cRYPHYRVIr8zaspEnc9S8fZNtw=; b=PBqsuNksqiYxLcyifzHiiquL6Zzzi+Q6QhZKvMqsl6Ywk8e+CwDNj9TY+ZBrYzU5TX4YZX tN7zZsn84kggt2lWPGZqKW8iUu8t1aNBnigvnGagmSkB+xzT/lcMTAqVdArQiFTX42gjln p/GMbq4RVKzlqVsGNHcXNmutrl2WTFQ= From: Usama Arif To: Andrew Morton , david@kernel.org, Lorenzo Stoakes , 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: [v3 16/24] mm: huge_mm: Make sure all split_huge_pmd calls are checked Date: Thu, 26 Mar 2026 19:08:58 -0700 Message-ID: <20260327021403.214713-17-usama.arif@linux.dev> In-Reply-To: <20260327021403.214713-1-usama.arif@linux.dev> References: <20260327021403.214713-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 224965fce4e66..c4d0badc4ce27 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -418,7 +418,7 @@ static inline int split_huge_page(struct page *page) extern struct list_lru deferred_split_lru; void deferred_split_folio(struct folio *folio, bool partially_mapped); -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); /** @@ -447,7 +447,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)) @@ -455,7 +455,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.52.0