From patchwork Fri Oct 20 14:13:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13430799 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 E5A3BC0032E for ; Fri, 20 Oct 2023 14:13:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E3048D00D1; Fri, 20 Oct 2023 10:13:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76C598D0003; Fri, 20 Oct 2023 10:13:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60D1B8D00D1; Fri, 20 Oct 2023 10:13:41 -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 4D85A8D0003 for ; Fri, 20 Oct 2023 10:13:41 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1E2A6B653D for ; Fri, 20 Oct 2023 14:13:41 +0000 (UTC) X-FDA: 81366033042.20.3AD3319 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf04.hostedemail.com (Postfix) with ESMTP id 499D440027 for ; Fri, 20 Oct 2023 14:13:39 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=rugqlokS; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf04.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.167.52 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697811219; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=cHYdL6+h/KwcGSepRnbK+lQxAZl07VmP927iBVBWsTk=; b=nAUQmJa/wp0aFENVhiJSEMn2LJMNa+r92v7ndHrV68doPvqcf9XNkdB5lL/5ZYNsuH87XC rkWxwCx2NHQDHA6QjOmRE+llip3kHjoa9hvuDaBHvpH5PghiRAp5dovGzURLzZDI0245ZE UsojP/2s8PfPTPbBojAi5eBmpqeLa/c= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=rugqlokS; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf04.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.167.52 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697811219; a=rsa-sha256; cv=none; b=LIlxYDNtLOkkq3Mhi/vBeFNkgrpsrla3yXbZ7fzhcXFt8A8XLfJEnxGr3iHc5AN1h6CYzY a1cNffJBHCMEom7uprvpn0OpW0zHkKLZMQCJHF8y8s0UvJ+txqalOC61c5ZoeE7GJSg5fM /TqOY2cGiYYGcLHJ6+5wnRPHUBV4rvg= Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-507c8316abcso1088836e87.1 for ; Fri, 20 Oct 2023 07:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697811217; x=1698416017; darn=kvack.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=cHYdL6+h/KwcGSepRnbK+lQxAZl07VmP927iBVBWsTk=; b=rugqlokSbrSAO4UiABOInNGwJH1axHEJcgqgzFcq1okJ2KnkUSJySpSneZfYcS3Ecb 4xqDC22MfjjdcKFUHN+K61eb1jXXYunZ6HJ/nebHX01x0SXxbkPuAxYgT1z+Dgc+183x mIZJzPdCXyrgQuR8qcXaAiIcozekKjB2eLfUj6Vgj/Uiat82rRgorVKzhzivH5Wcc+zO 0twTpZnZ4TMSJ0MBJsOfRLI+HpxUgneUdDgdTk54Z7MOK21+XSB5lkItbe8StuYYomUx RU5jg3Qz9zf6zyLNDbwrHRB28reqYkPEi5cwslxI0og/q7hlAY2lDRC3HoRVJBj3o72S jSNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697811217; x=1698416017; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cHYdL6+h/KwcGSepRnbK+lQxAZl07VmP927iBVBWsTk=; b=rLdZtABXJjpZMqCPNSSLHnTpKmqJ3OsUpPypLKRI8clRm1tkqErnXXAAfR0t31wkDl BDJf9fLY8vUdmokNwlqrqXAiLwywoqMZ5bIz7zc8fVNy0ejyPE6QULZASbiXR/UHIYVd lrd4j/6t4E87j5xxIkgaumRJiIW5nZ04wrNJPBdRQ6as+l0DO/JWAl3EVoWp/UbROnb5 bkKu5BAwAnWtrWOyyix0S6oooQ9n0rts0xNYtR02/JCqNoxdsNvYY1aB0iYNKkPqPIak GDwpwy8DGcANZERyBta4ZhkUu1OrHigiqdqWFP7xh6x+brLCuihVGMItRcyqqzQcO/BU kF6g== X-Gm-Message-State: AOJu0YzpO9JmzqVHHz3gJsFtLzCutfWLCiYxaPh0ade2uLvTyE9pAKn6 zeESbyFvFplx4rfUf4GDADCsJg== X-Google-Smtp-Source: AGHT+IH1LYjTguHo+MHaRdY/6I5NY/1iAzCe0zVXaxylTCz7I0h9K0wfoZx/8GaCPtGlTYREXSVw9Q== X-Received: by 2002:ac2:5456:0:b0:507:b074:ecd4 with SMTP id d22-20020ac25456000000b00507b074ecd4mr1394560lfn.7.1697811217367; Fri, 20 Oct 2023 07:13:37 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id k12-20020adff5cc000000b00326f5d0ce0asm1783191wrp.21.2023.10.20.07.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:13:37 -0700 (PDT) Date: Fri, 20 Oct 2023 17:13:32 +0300 From: Dan Carpenter To: Zach O'Keefe Cc: Andrew Morton , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] mm/khugepaged: Fix an uninitialized variable bug Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 499D440027 X-Stat-Signature: tt9ckpkuedq384t8ccggfu9uw8ohfzmp X-Rspam-User: X-HE-Tag: 1697811219-977940 X-HE-Meta: U2FsdGVkX1/887JbKW4uXmjXPoen+Tr5JishxI5MLz2NYVJAXGQKw8mAkEwuY8RuBo9CQ29BO4cdbv7F5dB9ExJqCPBK8e3Xzm6FksmX5O4ryG+sXzz7byVHXY/3noHS1qtg0VYFg8irM302Jey/qdaaNUn4TRwEwNnP+8KNxFRYIZrZUuG/hnlfVKDC9ymgAdX0Dx5keppHdlsJSGV1YhLg/akDL7Sv07ybatNsu3heJm8QBafuqytkHEVwJlztwzFPNdvxdg1q3QT4zT0oba/qLqBZrA27oKK1g8ucxGKzreCvuxJyW2uY1IuO6S3Kl2PTRiiG/GAFHAwdSuLaDCUi0k3qAQoD3DU+ReFMX5bt6wWRBrUdM3pZgaUjjaUjaTCzBRiQ99NBDsrWiFryMLdLRmxej0g19ETV6mulroxZDQECDUDblei2TTVzE66+zRR2n6VwLwJtFvBhJi5ZTf/HuYXV2psPjuEXi7biC+prBCOXjr48P1pTxOLmuUEfsX6aQWAreB0O5439+WBe5J7w1CZCKttPNF4QaBGku+a8K6VTGKojYOVK9/+PztqtNWFGM75LiztkmcWdZ/gmgeyggXb5jkfXmv4FzcxeVoeMVgQTV2p2oHcjpFXGpD/Zn/0zILD+5LGQ7jQp+bb5fh0sz7Q3/NyCcwEbTOPKnDfWD1Gm8gp32OeuRRfSE70LSrqDGh23KLEPfahDgVL7ky6M+9uqTbQjjeVljuF9XR+yNYbv2RjqMwcQKKlzAoYK/A4/bFPBqjSiK/2W7RGxjy13ieatcm6ZZ29fEhXn7gXGVm7Npc2dQgHn7cz1xITQD4J02lAN5JiIhJ2IKgeg/5qxcBTrUNu73F/aHcaBJIuF7+2KKltLQm+Hn35YPyGH5b0AvvWJDilFE7IEtXqj5XwCNKj15XHWyuqQRkQXBQ7I7B3BiERsU36/nLe6tb675Jcbbx7xdozLMtsMvDY H2jG4lzb qmmB5YinwRgqDC0JAvFI7YTFCtoWsU7326NsOgljgEdKnbqphTVQrNmceTmS64W94g6qXz9l8K2QftXC24/yCpsqQ6mhH9UenHALKHAagHvDdxTbibIKXp4G6N3U3Bsy20XF5zIzZAm871iB+wq3rrlMBaXZzOXn3ImnT4MpROS60Vn50trGfVFWIY5OGAW63WhxX/5TTgBs1TnjtI/bn60Hg+Oc8NBve9lQ0hzSnK9GlQy5t4ZXzm6NqBypElalqK/xoH7FHrLQAa0Cu3hTYLX8M0CozQwEa3M2QV0C/aHpbwjSBb+HZVRKMJzBk5OZRXQpF9jJCcQttHUGijSGnMKo0TP4UnQz4YN7swJydq3XQ9jwTQbo9gm5TUMQoWzyO9rcMxn1hvdr2wTfgwOAgvvaAeQ== 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: Smatch complains that "hpage" can be used uninitialized: mm/khugepaged.c:1234 collapse_huge_page() error: uninitialized symbol 'hpage'. Initialized it on this path. Fixes: 50ad2f24b3b4 ("mm/khugepaged: propagate enum scan_result codes back to callers") Signed-off-by: Dan Carpenter --- From static analysis. Not tested. mm/khugepaged.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 0622f8a5175d..a25f5b7c3e7e 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1062,8 +1062,10 @@ static int alloc_charge_hpage(struct page **hpage, struct mm_struct *mm, int node = hpage_collapse_find_target_node(cc); struct folio *folio; - if (!hpage_collapse_alloc_folio(&folio, gfp, node, &cc->alloc_nmask)) + if (!hpage_collapse_alloc_folio(&folio, gfp, node, &cc->alloc_nmask)) { + *hpage = NULL; return SCAN_ALLOC_HUGE_PAGE_FAIL; + } if (unlikely(mem_cgroup_charge(folio, mm, gfp))) { folio_put(folio);