Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp686985pxb; Thu, 21 Jan 2021 18:04:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqykThNiwfh8+lQr0K3KRW150oL7B76w/JaFRvta9y1OU+35DY4SNht0IV6YI2qDvpstuh X-Received: by 2002:a17:906:478a:: with SMTP id cw10mr1429092ejc.533.1611281083726; Thu, 21 Jan 2021 18:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611281083; cv=none; d=google.com; s=arc-20160816; b=OB/i0J2niJlkG4gOXvTbo0lE8ygUq28stkl16SRZjsp87sHYl6cdeFEQCwBCI+zGVq aL/PqgAESLCUO2Onpt4qiM4zcAuMOKhEU+l0N7R8qCpnx/7rak7wK4hztn6Nfbuet824 nWqDFOhsH2+djN668EYrc0SWuC19UYNQ6z6HffaIs0ZlPAEHQwq3ccyPKotFA3tlVS+v Pq4fFasXhN+P2+PxwjgLn96S0rTxMwi4ks06/OswhrdMgBwSmYGpF0V1s6DstL1lNz0R tFoy/genh2cZfYHXW1X4BF0qxMPUvR28g1L68FvKqnqmarLuEZybQTUg5wilXznYlSJj D2Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=He7Ipru9SjsghaUbWpf20vtpeeTsE3BSNY4Vx3ovvlQ=; b=l9437Lut77zQ+6oPjO5ZB384qBF+ofLis/hpyoMsrKZKMaTjakPz71fK/5zSKE5Sql KpLCt9ihc8ddJVqeY3qXYNbG44V08Yp5rdpKckYo+rTdsWBCuQbVASL9VEUb6TBMpuKL 5hfb2dRw5QGlFxebFgP/Txvj2k9esvfYnXPR2EEEEA+Kty/2H/XbOslZrJZ4U+yNECmu YG20ZdcY2H8YTevVeaIDLc4oIQf6c7dXuRN+CCuGrguiNRysE5Q/x0zaU8QezIfQSvDU RWUAIwaIOpVE35XsGGK2kKS4zj5EpJYWp/7HFamshV8yju5RPaLj8GWi8bPFGL7eRxWz lmzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp6si2426226ejc.532.2021.01.21.18.04.18; Thu, 21 Jan 2021 18:04:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbhAVB73 (ORCPT + 99 others); Thu, 21 Jan 2021 20:59:29 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11474 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbhAVB72 (ORCPT ); Thu, 21 Jan 2021 20:59:28 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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