From patchwork Thu Jan 21 21:48:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12037835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E010C433E0 for ; Thu, 21 Jan 2021 21:49:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E774823A54 for ; Thu, 21 Jan 2021 21:49:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E774823A54 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E8886B0006; Thu, 21 Jan 2021 16:49:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 572436B0007; Thu, 21 Jan 2021 16:49:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 439B56B0008; Thu, 21 Jan 2021 16:49:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 296116B0006 for ; Thu, 21 Jan 2021 16:49:16 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DFB721730842 for ; Thu, 21 Jan 2021 21:49:15 +0000 (UTC) X-FDA: 77731123470.24.fifth03_0e1102327566 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id C18051A4A0 for ; Thu, 21 Jan 2021 21:49:15 +0000 (UTC) X-HE-Tag: fifth03_0e1102327566 X-Filterd-Recvd-Size: 4634 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 21:49:15 +0000 (UTC) Received: by mail-qv1-f51.google.com with SMTP id az16so1715469qvb.5 for ; Thu, 21 Jan 2021 13:49:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EMFjqjTXoNJLUscEpZ/FobMrZilvYZKYbWkmE88q0Nk=; b=DlXyrvOFv1gzMSG++klZkcCxz+TQqS8ZU822IMiAtWR3ZWqEpKuGcEf19qVANlnHVA kVdqixUar++8l3wa2ir+0gu4XFGzb6dl9tef+t03OYCNeYgdKs92HDJB9lN7m6cWJAuE jB4TgzfT0yWJbxA6+OKcLoiDxV/uKn7VtA/wYgkjW5bBB5T39SCNBBbWqNzW8Cdl9wpt W8QemlntvmkD0q7Lv9ZHZHmCWR7LOs3ZqJCbXXpdYzbD7lpktCYcNj2NugLJ2mtOkrrU dXq+pIYT4X7HdL89vFsGRg6KN36c2AzlUkmL+/CvCjijLZRmCq5FINv8cERUkqwA+2JT PK9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EMFjqjTXoNJLUscEpZ/FobMrZilvYZKYbWkmE88q0Nk=; b=lYMaPWJZJLvZgZsOyVBmiOP+WGyBfXjXpBnp4xAwnfGEnnMYqRhcE9oj4kq2X66kwH wdqsTjIE+5uqN5GSVE13HuUx2Phs5WoCBdz0jLbZIkVYfqRYipJtsKbUL9JcZYCW9FDt ZEnSRFL/tzARkXsIDgWRu/uyCvscL74iQW0tUozog8u1D/p4yllaVdZqVGPG8NI+Lf5o /Yf5ggo0hCnJm4J7VXeotQCkEC7ja4980cdjE/h7GMpSX7RV3J7C2gL+j2PyGSe1VYF3 ME1IFORdCpwWu4qnOupfY2a+DtJGo1SpjnJxIjM4ty6sbJHCCbHZBteVW57xoquxyKlW EzOg== X-Gm-Message-State: AOAM532DWyH6ViQQLMM8JgvZjSPXPv0TfmIf0l29S7NZR1haGY8BY3gy 4T5UbRcZHwUYqgVdDMjTalg= X-Google-Smtp-Source: ABdhPJyXFtJUU+wH8WxQcgflcqzKGuymkAZxdqgdPN/mIEvRuhMUCHzBkMYVmgn++MD+nvTcXHWoDg== X-Received: by 2002:ad4:434e:: with SMTP id q14mr1751382qvs.15.1611265754645; Thu, 21 Jan 2021 13:49:14 -0800 (PST) Received: from localhost.localdomain ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id q73sm4672937qke.16.2021.01.21.13.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 13:49:14 -0800 (PST) From: Nathan Chancellor To: Andrew Morton Cc: Seth Jennings , Dan Streetman , Vitaly Wool , Nick Desaulniers , Tian Tao , linux-mm@kvack.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , "kernelci . org bot" , kernel test robot Subject: [PATCH] mm/zswap: Add return value in zswap_frontswap_load Date: Thu, 21 Jan 2021 14:48:05 -0700 Message-Id: <20210121214804.926843-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Patchwork-Bot: notify 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: Clang warns: mm/zswap.c:1271:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!entry->length) { ^~~~~~~~~~~~~~ mm/zswap.c:1322:9: note: uninitialized use occurs here return ret; ^~~ mm/zswap.c:1271:2: note: remove the 'if' if its condition is always false if (!entry->length) { ^~~~~~~~~~~~~~~~~~~~~ mm/zswap.c:1259:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 warning generated. Prior to "mm/zswap: add the flag can_sleep_mapped", this path always returned 0. Restore that so we are not returning uninitialized memory. Link: https://github.com/ClangBuiltLinux/linux/issues/1263 Reported-by: kernelci.org bot Reported-by: kernel test robot Signed-off-by: Nathan Chancellor Reviewed-by: Miaohe Lin --- Andrew, please fold this into mm-zswap-add-the-flag-can_sleep_mapped.patch mm/zswap.c | 1 + 1 file changed, 1 insertion(+) base-commit: bc085f8fc88fc16796c9f2364e2bfb3fef305cad diff --git a/mm/zswap.c b/mm/zswap.c index 6e0bb61d2a2c..a85334b719b9 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1272,6 +1272,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset, dst = kmap_atomic(page); zswap_fill_page(dst, entry->value); kunmap_atomic(dst); + ret = 0; goto freeentry; }