linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tiantao6@hisilicon.com
Cc: linux-mm@kvack.org
Subject: [bug report] mm/zswap: add the flag can_sleep_mapped
Date: Fri, 22 Jan 2021 14:11:43 +0300	[thread overview]
Message-ID: <YAqyy9EQ1MsHknRF@mwanda> (raw)

Hello Tian Tao,

The patch 6753c561f653: "mm/zswap: add the flag can_sleep_mapped"
from Jan 20, 2021, leads to the following static checker warning:

	mm/zswap.c:1322 zswap_frontswap_load()
	error: uninitialized symbol 'ret'.

mm/zswap.c
  1250  static int zswap_frontswap_load(unsigned type, pgoff_t offset,
  1251                                  struct page *page)
  1252  {
  1253          struct zswap_tree *tree = zswap_trees[type];
  1254          struct zswap_entry *entry;
  1255          struct scatterlist input, output;
  1256          struct crypto_acomp_ctx *acomp_ctx;
  1257          u8 *src, *dst, *tmp;
  1258          unsigned int dlen;
  1259          int ret;
  1260  
  1261          /* find */
  1262          spin_lock(&tree->lock);
  1263          entry = zswap_entry_find_get(&tree->rbroot, offset);
  1264          if (!entry) {
  1265                  /* entry was written back */
  1266                  spin_unlock(&tree->lock);
  1267                  return -1;
  1268          }
  1269          spin_unlock(&tree->lock);
  1270  
  1271          if (!entry->length) {
  1272                  dst = kmap_atomic(page);
  1273                  zswap_fill_page(dst, entry->value);
  1274                  kunmap_atomic(dst);

ret = 0; on this path?

  1275                  goto freeentry;
  1276          }
  1277  
  1278          if (!zpool_can_sleep_mapped(entry->pool->zpool)) {
  1279  
  1280                  tmp = kmalloc(entry->length, GFP_ATOMIC);
  1281                  if (!tmp) {
  1282                          ret = -ENOMEM;
  1283                          goto freeentry;
  1284                  }
  1285          }
  1286  

regards,
dan carpenter


             reply	other threads:[~2021-01-22 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 11:11 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-22 11:08 Dan Carpenter

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=YAqyy9EQ1MsHknRF@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=tiantao6@hisilicon.com \
    /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