From patchwork Fri Oct 20 14:14:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13430800 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 CAC55C00A98 for ; Fri, 20 Oct 2023 14:14:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C19D8D00D3; Fri, 20 Oct 2023 10:14:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 572408D0003; Fri, 20 Oct 2023 10:14:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4398A8D00D3; Fri, 20 Oct 2023 10:14:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 335AA8D0003 for ; Fri, 20 Oct 2023 10:14:45 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 06C2214074E for ; Fri, 20 Oct 2023 14:14:45 +0000 (UTC) X-FDA: 81366035730.25.10CE224 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf14.hostedemail.com (Postfix) with ESMTP id 13C6110002D for ; Fri, 20 Oct 2023 14:14:42 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b="Cf/VuUGP"; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf14.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.167.51 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=1697811283; 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:in-reply-to:references:dkim-signature; bh=LEix6po77+AMxuWac9tyRezPTBXoF+z3J1JlBq21Qdw=; b=kBtEwNvXKrsMo5KBTWkTS7RfVVRWItbRTTxm20rVzboj5INSdHNY5oFLXB0V3VbadOypeO 7tbuhtHrMQ4Wv8Da/yYRpMawTkKlndNCozqxmtZvD8s5lsG6xYJYsK68qn8maWSzx8PW3p iFzeuNTYpV5AWR73K0KaQfjiARtpOcY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b="Cf/VuUGP"; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf14.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.167.51 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697811283; a=rsa-sha256; cv=none; b=Vnbc0w1bWgT4LRxDQ3Kdh3DuGGLOQZbEF5kzYqWoBZR6VF8WBrZZZFzSzpYZwtGooKior1 D111aUiVySifLHu2HCkPVhlkn1Zzu8SDSRM9JkMhDW7Fh7IGqYzhBrR9PBV9orT73YLUZ5 FQCK2aPlj7CYLabFE7S72WOYL9TS3mM= Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-507be298d2aso1223094e87.1 for ; Fri, 20 Oct 2023 07:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697811281; x=1698416081; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LEix6po77+AMxuWac9tyRezPTBXoF+z3J1JlBq21Qdw=; b=Cf/VuUGPFhH+av2YZHGNf4Je6/3mqyRwQWFM06heug4dGyHJIshyGlVYqbcNd699B7 v7tazSpc/Kzh/lFji7gqqOj8sxa+cu/M9nZE8kvWxemvONRhzq2KgeRf9iudYoFCXIrH MJd8YRbg8lQUCOAupsmoERR+UEDEvlAue8kq0JymCNhbeLG9M8QTihLOaeWE2ktKlnlW JPumfURztmnsLHz70LGRLIZUD+dhRCQ+Jc4GOtzWzk88XbBatVMen9RuutCOWkQwzMuL W7LO+C8dESevmDJgaeVsJHXYG36Tg5sEaX8fnSNpIVYPhXDakJjdQ9EjMTp607LN8mJc Ftqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697811281; x=1698416081; h=in-reply-to: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=LEix6po77+AMxuWac9tyRezPTBXoF+z3J1JlBq21Qdw=; b=WufVrp95wfEtkISpATVjX/NGPZZwqUUZStv6UaXvHIbe4ihcxLSXRU+7LsrzkzcOVw PA3YSU/NhYyOVxEdxfLlJei/hilEhptOK5iyPXOTkDbV3b2zS4C6HgUYIx0XFWSS8lfu ovgLf23RqvhxGMU4zGKHA1eQ4PVHYQ8gDWf2cY6kGYz5dqKz9UpQf9a0jvJ5jx+FjgZL Q223QJhlqNFLKQkb2svZex9v6yseJpvdyw8wzao7sUzsgOdIwE6nzwuwM+fgAj1nH1Zu BZO1qlR4twd46rxTalO2Dhyrz1t90nYAORQeS3OiBnb6fFHku/cW1pDZClPW3GEzCbMw zhMg== X-Gm-Message-State: AOJu0YyvpZodHiSqIn9IDOxobfUGzf6AKNflegI57qf5wOgbpX2ORuzl DtrkjT1kBokXKYa+stUH6P+HHdACHQWF1OJGfys= X-Google-Smtp-Source: AGHT+IEY2Q9dTva1HRYc1JRcPd5non3mbbT8bCtSnB6B4Az9MRd90pdBRPvphDwQxh4UQwpNLeOgYQ== X-Received: by 2002:a19:9156:0:b0:503:985:92c5 with SMTP id y22-20020a199156000000b00503098592c5mr1303266lfj.42.1697811281442; Fri, 20 Oct 2023 07:14:41 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id m10-20020adffe4a000000b0032ddc3b88e9sm1822215wrs.0.2023.10.20.07.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:14:41 -0700 (PDT) Date: Fri, 20 Oct 2023 17:14:36 +0300 From: Dan Carpenter To: Vishal Moola Cc: Andrew Morton , linux-mm@kvack.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] mm/khugepaged: Fix a NULL vs IS_ERR() bug in collapse_pte_mapped_thp() Message-ID: <0882a964-770e-418c-9c34-1a64195baafc@moroto.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-Rspamd-Queue-Id: 13C6110002D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 1wgs6sduepfjbxknkdpm5g1tq8o1rfh1 X-HE-Tag: 1697811282-3739 X-HE-Meta: U2FsdGVkX1+FK2XnsOyGuwq6X5IZFPevCQ3yWVrFXissdzKRMCD4jdcRrmJjn5UFPEUOOSmFXFbD4oeJFLtsw2DcGnO5gMWnvt0UN7wru/X5M1+ljMLq2kHDrI0NZmFt43Hy1ISTyQVI1GEz9bzRtw2pnkyDkcjMiIxdfAIVE8eC7pswcAlaeW0TjORMOo++In+gfvu5weLPkmpnn+45841eCYoLEVbL5JljiLLRfeSFZypkTNhf2WIIuwrJ3Rew4FVbkf3jKDXvW8izp1yDKclZnU6ufjSsezdhXrC48Icj8yksN2NbhLEJ3nCMvfWrqj5/+6/JauPoLmUcUq0eJiNxiGmPnnE5hKKBU60RY5Rm9gA0g5eBDaroBXbBk/pKK199RaA3DvFghZgA7iABsvBvnWYP+coWVbZGV070z72lVEKStQ5hQR8gnlZ2uJsWsP9EgaeRTZhoe88iyl0G9R8Tffqogi5QbpknlJxazkOXnKBZCu4hum3I3cyAEPMWn29xxZ2YDW0K//L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@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This was changed from find_lock_page() which returns NULL to filemap_lock_folio() which returns error pointers. Update the error checking to match. Fixes: 8f5654d233e3 ("mm/khugepaged: convert collapse_pte_mapped_thp() to use folios") Signed-off-by: Dan Carpenter --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index a25f5b7c3e7e..d977eb50704a 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1508,7 +1508,7 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr, folio = filemap_lock_folio(vma->vm_file->f_mapping, linear_page_index(vma, haddr)); - if (!folio) + if (IS_ERR(folio)) return SCAN_PAGE_NULL; if (folio_order(folio) != HPAGE_PMD_ORDER) {