Re: [linux-next:master 5938/6538] mm/zswap.c:1183:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 1 Jun 2023 14:29:13 +0800 kernel test robot <lkp@xxxxxxxxx> 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()) {
_





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux