From mboxrd@z Thu Jan 1 00:00:00 1970 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=-20.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 EC753C433E0 for ; Fri, 22 Jan 2021 01:58:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C8F0239D4 for ; Fri, 22 Jan 2021 01:58:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C8F0239D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7F55E6B0006; Thu, 21 Jan 2021 20:58:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A5146B0007; Thu, 21 Jan 2021 20:58:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BB6D6B0008; Thu, 21 Jan 2021 20:58:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 539B46B0006 for ; Thu, 21 Jan 2021 20:58:53 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1FCFB5830 for ; Fri, 22 Jan 2021 01:58:53 +0000 (UTC) X-FDA: 77731752546.15.match61_251007627568 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id F1F8D1814B0C7 for ; Fri, 22 Jan 2021 01:58:52 +0000 (UTC) X-HE-Tag: match61_251007627568 X-Filterd-Recvd-Size: 3447 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 01:58:51 +0000 (UTC) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DMMpT0L3rzjBtN; Fri, 22 Jan 2021 09:57:37 +0800 (CST) Received: from [10.174.177.2] (10.174.177.2) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Fri, 22 Jan 2021 09:58:36 +0800 Subject: Re: [PATCH] mm/zswap: Add return value in zswap_frontswap_load To: Nathan Chancellor CC: Seth Jennings , Dan Streetman , Vitaly Wool , Nick Desaulniers , Tian Tao , , , , "kernelci . org bot" , kernel test robot , Andrew Morton References: <20210121214804.926843-1-natechancellor@gmail.com> From: Miaohe Lin Message-ID: <2438a24b-b312-dc91-0ebd-63e3baa2ad6b@huawei.com> Date: Fri, 22 Jan 2021 09:58:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210121214804.926843-1-natechancellor@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.2] X-CFilter-Loop: Reflected 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: Hi: On 2021/1/22 5:48, Nathan Chancellor wrote: > 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 Looks like commit 6753c561f653 ("mm/zswap: add the flag can_sleep_mapped") introduced this warning. > Signed-off-by: Nathan Chancellor > --- > > Andrew, please fold this into > > mm-zswap-add-the-flag-can_sleep_mapped.patch > > mm/zswap.c | 1 + > 1 file changed, 1 insertion(+) > > 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; > } > > > base-commit: bc085f8fc88fc16796c9f2364e2bfb3fef305cad > Reviewed-by: Miaohe Lin