public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: kernel test robot <lkp@intel.com>
Cc: Nhat Pham <nphamcs@gmail.com>,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 5938/6538] mm/zswap.c:1183:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
Date: Thu, 1 Jun 2023 13:19:49 -0700	[thread overview]
Message-ID: <20230601131949.e6ff7f41ac3fec6875b16e8c@linux-foundation.org> (raw)
In-Reply-To: <202306011435.2BxsHFUE-lkp@intel.com>

On Thu, 1 Jun 2023 14:29:13 +0800 kernel test robot <lkp@intel.com> wrote:

>            if (objcg && !obj_cgroup_may_zswap(objcg))
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    mm/zswap.c:1327:9: note: uninitialized use occurs here
>            return ret;
>                   ^~~
>    mm/zswap.c:1183:2: note: remove the 'if' if its condition is always false
>            if (objcg && !obj_cgroup_may_zswap(objcg))
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    mm/zswap.c:1158:9: note: initialize the variable 'ret' to silence this warning
>            int ret;
>                   ^

Thanks.  I did the below.  Maybe ENOMEM would be more appropriate...

--- a/mm/zswap.c~zswap-do-not-shrink-if-cgroup-may-not-zswap-fix
+++ a/mm/zswap.c
@@ -1180,8 +1180,10 @@ static int zswap_frontswap_store(unsigne
 	 * local cgroup limits.
 	 */
 	objcg = get_obj_cgroup_from_page(page);
-	if (objcg && !obj_cgroup_may_zswap(objcg))
+	if (objcg && !obj_cgroup_may_zswap(objcg)) {
+		ret = -ENOSPC;
 		goto reject;
+	}
 
 	/* reclaim space if needed */
 	if (zswap_is_full()) {
_


  reply	other threads:[~2023-06-01 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  6:29 [linux-next:master 5938/6538] mm/zswap.c:1183:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
2023-06-01 20:19 ` Andrew Morton [this message]
2023-06-01 20:21   ` Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230601131949.e6ff7f41ac3fec6875b16e8c@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox