From patchwork Thu Mar 23 11:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13185583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E542DC6FD1C for ; Thu, 23 Mar 2023 11:59:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 811B06B0075; Thu, 23 Mar 2023 07:59:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C2236B0078; Thu, 23 Mar 2023 07:59:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B1906B007B; Thu, 23 Mar 2023 07:59:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5D4206B0075 for ; Thu, 23 Mar 2023 07:59:17 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 204141405E0 for ; Thu, 23 Mar 2023 11:59:17 +0000 (UTC) X-FDA: 80600017554.25.9C81542 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf01.hostedemail.com (Postfix) with ESMTP id 6177540003 for ; Thu, 23 Mar 2023 11:59:15 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tBTAYbPS; spf=pass (imf01.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679572755; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ParquFYygbbuO9rRASghQvFuA9lGdMYqOAhC7AI0i5w=; b=iqRWw1hqQ+/vj5prgvBVNYDRsSmMeEqZvpw9dDMH+ZdYRbhk5ruzKaWpM8rXUPuFCxuO6L 2CgU6EfufYRmjHRueq87HqRa55rErRv/651RnRWRyfLc/4v2kPKsKPUGiMsUJogF32dV4D eyUIlO41oOWUQnzFvLuqNAUEcuQhmXY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tBTAYbPS; spf=pass (imf01.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679572755; a=rsa-sha256; cv=none; b=wb2W00pOxxPPjhwDnObIZDzXdPWxHeDWwwSN0YXDpYofJfNJRwPMzklN3uar7ylPKuVgEW Z2y+y9gsqUPLhFN74stqzbgemAwfdASTt8dSTb9n7xOfrBC3SUS5kxKvqk3SKenSws68yg yKn0GPG/d9XeFV+LPEhPLSy4qe0u7uk= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8398B820D4; Thu, 23 Mar 2023 11:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99E6BC4339C; Thu, 23 Mar 2023 11:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679572752; bh=XWLuxoeuAjQ0mUCYpCvh//KdRJ/f4l5MIwreKshFoaM=; h=From:To:Cc:Subject:Date:From; b=tBTAYbPS1lzP8x3XUCu1oh/aQIAFffDcYizxUgHHLq8+EBr1yoibNnSB25Fjgqecq BQrgn/kTrTGTYYCiLC3wdTqsMpcdzsvIMUAXsqe/nbxZNXv9qg23we0idnZR5og2jw U82IGtiPy3aqbBXoeoXbiovfzpEKNaheKqs74TluFDlxXOQ/VIY075Tgv/VgseLhq9 rsGPMZLMQ8f5+DMBdly9fscK3PcZk1CxJ63dELFEirOgTTioOKx9JZI0haa1SzwLA5 WYEIGxSY4pZQZ8K5qAWsCWLcbGCpuRRkWVAmf8g7cWSLUHFpqLKqR3E7PYP68FXQct G6gsSvaoLWKCQ== From: Arnd Bergmann To: Andrew Morton , Lorenzo Stoakes Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Liam R. Howlett" , Vlastimil Babka , Suren Baghdasaryan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 1/3] mm/mmap/vma_merge: actually set next to NULL if not applicable Date: Thu, 23 Mar 2023 12:58:34 +0100 Message-Id: <20230323115903.1483668-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6177540003 X-Rspam-User: X-Stat-Signature: g6ik54c6h9h7cg5mk1hs1enred37h9ge X-HE-Tag: 1679572755-818694 X-HE-Meta: U2FsdGVkX197V44xUQS00WfwYgmD5k86koXdW/zJWB/B9GhSh3rJpWVqVobSNkTWB3j25J8ix1jDGLVMpiXb/K5qFlF+sV1BK3oDM5GvfEM62kjYMddAA6JAFXJJh+ZWJ7SAET8jQzdfu1aR2r3qLjQR9y8MUyr1ysaFrCDqnyzYw40puzKDsFum0NfafQPsTgw0koOwTsnFndhq+RILr7hMAqBy6h6Nh01hLG5ly0asOIyf9rZkft5wYQ1b6hAuCGjkjU+zjQO2atqIF7PVW0anrDUXQa7ufucsXkitOnxg5h8m3p4FgKm2sJ1KxKLM9Q8s7sLYB9okxtHPPnrRmmPzu8W/nD+EK6WKmSrBc/Z1/1rueIWch2Rj0w4zgdryyoWNtwstvfzYyiW5pHKiE17RL0R8Z1QcJHBTFp7Brr8oa2E5fRF/qjzTOPXiunoUIdbRsOZErbHV64AEcUflvJ730UHhQD5UB9xL7DyRWCcn/TtRBAfkBAt83xSEHKYkKR3geW0MiFTckkNd+gy17X0Fe0GTO0aOBa+2zPBuCe6eBHuWfjKqy3vFFPEafCxwIKE1ItVVgJfKdmHjzFzlLETp6/KAQsJagveN52V/QPuUS4clP2KNxju6P0VUp7r6APbLnr/BtdFlzBEawcbU/PgAc3sI+8qiXmOuJQniqVawNEio5vCxmYl30V5q6AqQGuP5QYvCLefpHIImEP/kjPdzm3bN8Xo/KErQ4bgDcApYOdmSdntXazD2oZ4IxLGsZY/Qp2pXAfb5oSGhm+0UxXe0qbgOoeS4iOSlHwO5L56erXP5JJ4KBkUaoKOZHPSg8IoI95hqUVGiSF9iXgFNFur30yPke1paw60S5qisUTz+TwJnqpnmdbUFKtuFJ5Z1AKH0qQpWE/eOmXKcUvpP+U3zXld+EdvIJ5cVwR84tpczu94fiWKgmQbh5hDH/3IU7LG0IThQ7fHwgbfTPCM Yiew7DII HSbqTq9o+ee/n9y9U+9ICzkMKf3tvoh0mX0QKruuC/MC4HALcSrpTRToOfKyN/Sycue3X1Eo5icEZmbn1MVCc/N8E3AHsZd6zp/KlAGQ/6ZWQum1zpOqLg4zj1KG73G0J/ZOWt4ukxNotf74dQd5b8SzQcbLKFELSbgYW2ERBIKdirtyOB70Da26An8QjHojXpPL9a+z6JkjquuHAS9CK7objI69DPs8PfoE5wIob2PBJuj1eZYM6dmVG63oCZhXVeIE+jJqkKZV5XtkH+sdQU2PyFXaXefiIqV1V X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Arnd Bergmann As clang builds point out, the variable 'next' is now uninitialized in some conditions as a result of a previous patch that tried to rely on it being NULL here: mm/mmap.c:939:11: error: variable 'next' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] else if (!curr) ^~~~~ mm/mmap.c:952:15: note: uninitialized use occurs here merge_next = next && mpol_equal(policy, vma_policy(next)) && ^~~~ Fixes: e887ecae997e ("mm/mmap/vma_merge: set next to NULL if not applicable") Signed-off-by: Arnd Bergmann --- mm/mmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index 54099a604cf8..c01d43bd694e 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -939,6 +939,8 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, else if (!curr) /* Is there a VMA next to a hole (case 1 - 3) or prev (4)? */ next = vma_lookup(mm, end); + else + next = NULL; /* Can we merge the predecessor? */ if (prev && addr == prev->vm_end && mpol_equal(vma_policy(prev), policy)