From patchwork Mon May 9 12:31:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12843481 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 A1C6CC433EF for ; Mon, 9 May 2022 12:31:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC9176B0071; Mon, 9 May 2022 08:31:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D78146B0073; Mon, 9 May 2022 08:31:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF13F6B0074; Mon, 9 May 2022 08:31:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A96F66B0071 for ; Mon, 9 May 2022 08:31:34 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7631F61123 for ; Mon, 9 May 2022 12:31:34 +0000 (UTC) X-FDA: 79446140508.25.B234E30 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id E232C10008E for ; Mon, 9 May 2022 12:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652099493; h=from:from: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:content-transfer-encoding; bh=gEOVNDDSpKASfNP7Ge49MOGYJd/s6CThQbdN++TPQOc=; b=acTMg3p/3bjAcOM8TzAzviGHgy6li3VzjDn6iPepjVxeBk718zKqOTTD+BLhH18HmDywX1 B2jEh/NFZEWWf1p97CBBTlZEn+Zvm1eGv3KoUX7B8le1X7x1NerAYdLTrzdEDcy+NwiBqh e/H5FYq2usztnoKTq8G4X5AXNXo5Hgs= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-319-WzpYHtYVM-uLizamb2IEzg-1; Mon, 09 May 2022 08:31:32 -0400 X-MC-Unique: WzpYHtYVM-uLizamb2IEzg-1 Received: by mail-qv1-f70.google.com with SMTP id kj4-20020a056214528400b0044399a9bb4cso11634865qvb.15 for ; Mon, 09 May 2022 05:31:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gEOVNDDSpKASfNP7Ge49MOGYJd/s6CThQbdN++TPQOc=; b=P+mOKuI5IkcJqt0dwogsdh0zwbNS1p+12lc1tvCrVKPuyysasMSLupCorvIgqZ/kbQ 2odySgm8qtjzTCYEu+szUnSYCL92dI6yeEg8EBK4V0a8kpr4ibnuzRQRFuMpK8r4D+jA q69xBbAC8fqrx02Furiu6ljPu6eWOwYt1r4BB+SaVti62zV0VW6sZZaotTKMqcWP3iDo wtm+6QTXnIx3PwOpulroVsGU7VxKoVBhOTZ6KBM6UcHLdDImOXy0xz8d61zOV+9S3hDi 5NWDu+3GJ1pBU6cbYOzka7BvuIQBO+6ULZbJ1Qk1dChVfmBbd95Ei2aNprqD98C6m6LB Ajqg== X-Gm-Message-State: AOAM532Y3+eJdwY1uDc3eHoEA2fm9lwUCpGVVXYRTYORahyfzOkXEjI3 Vguyk9qelzVDGFcgIAdrlci9fDGaoyT3w5oF/iz35uj+Y9Ju9vwq86l6CC4wTVX+WAQXWrjm/Jp fovMIWDWgh9k= X-Received: by 2002:ac8:5954:0:b0:2f3:7d71:869e with SMTP id 20-20020ac85954000000b002f37d71869emr14705068qtz.183.1652099491277; Mon, 09 May 2022 05:31:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxHsEqi5MAo7TiJ6W+7CBlLKlZqhZAzL8aK4UMWuppI0cXur/TKjXyNde7+COugsYcZctc+w== X-Received: by 2002:ac8:5954:0:b0:2f3:7d71:869e with SMTP id 20-20020ac85954000000b002f37d71869emr14705046qtz.183.1652099491002; Mon, 09 May 2022 05:31:31 -0700 (PDT) Received: from dell-per740-01.7a2m.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id o27-20020a05620a15db00b0069fc13ce203sm6736097qkm.52.2022.05.09.05.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 05:31:30 -0700 (PDT) From: Tom Rix To: hughd@google.com, akpm@linux-foundation.org, nathan@kernel.org, ndesaulniers@google.com, willy@infradead.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Tom Rix Subject: [PATCH] mm/shmem: initialize folio to NULL Date: Mon, 9 May 2022 08:31:16 -0400 Message-Id: <20220509123116.3169267-1-trix@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: s65odm3gtm6qy8xsadrxq3juumkasgif Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="acTMg3p/"; spf=none (imf14.hostedemail.com: domain of trix@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=trix@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E232C10008E X-HE-Tag: 1652099491-446435 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: The clang build fails with mm/shmem.c:1704:7: error: variable 'folio' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!page) { ^~~~~ The error handler for !page jumps to an if-check for an unset folio. So initialize folio to NULL. Fixes: 2b58b3f33ba2 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()") Signed-off-by: Tom Rix --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 107f1e4dd0aa..7faaa61ff7fa 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1682,7 +1682,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index, struct shmem_inode_info *info = SHMEM_I(inode); struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL; struct page *page; - struct folio *folio; + struct folio *folio = NULL; swp_entry_t swap; int error;