[bug report] mm/zswap: add the flag can_sleep_mapped
From: Dan Carpenter <hidden>
Date: 2021-01-22 11:11:55
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