All of lore.kernel.org
 help / color / mirror / Atom feed
* [kas:kvm-unmapped-memfd-secret 207/305] mm/zswap.c:991 zswap_writeback_entry() error: uninitialized symbol 'tmp'.
@ 2021-02-26 21:41 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-02-26 21:41 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 12667 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Tian Tao <tiantao6@hisilicon.com>
CC: Johannes Weiner <hannes@cmpxchg.org>
CC: Vitaly Wool <vitaly.wool@konsulko.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git kvm-unmapped-memfd-secret
head:   35cd9bac55b24aa06d68edf986f14cd67932470f
commit: 2cfe0cf0b0e27bb3515f95de13bea1a56699cd5b [207/305] mm/zswap: add the flag can_sleep_mapped
:::::: branch date: 8 hours ago
:::::: commit date: 4 weeks ago
config: x86_64-randconfig-m001-20210226 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
mm/zswap.c:991 zswap_writeback_entry() error: uninitialized symbol 'tmp'.
mm/zswap.c:1295 zswap_frontswap_load() error: uninitialized symbol 'tmp'.

vim +/tmp +991 mm/zswap.c

2b2811178e8555 Seth Jennings      2013-07-10   914  
2b2811178e8555 Seth Jennings      2013-07-10   915  /*
2b2811178e8555 Seth Jennings      2013-07-10   916   * Attempts to free an entry by adding a page to the swap cache,
2b2811178e8555 Seth Jennings      2013-07-10   917   * decompressing the entry data into the page, and issuing a
2b2811178e8555 Seth Jennings      2013-07-10   918   * bio write to write the page back to the swap device.
2b2811178e8555 Seth Jennings      2013-07-10   919   *
2b2811178e8555 Seth Jennings      2013-07-10   920   * This can be thought of as a "resumed writeback" of the page
2b2811178e8555 Seth Jennings      2013-07-10   921   * to the swap device.  We are basically resuming the same swap
2b2811178e8555 Seth Jennings      2013-07-10   922   * writeback path that was intercepted with the frontswap_store()
2b2811178e8555 Seth Jennings      2013-07-10   923   * in the first place.  After the page has been decompressed into
2b2811178e8555 Seth Jennings      2013-07-10   924   * the swap cache, the compressed version stored by zswap can be
2b2811178e8555 Seth Jennings      2013-07-10   925   * freed.
2b2811178e8555 Seth Jennings      2013-07-10   926   */
12d79d64bfd391 Dan Streetman      2014-08-06   927  static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
2b2811178e8555 Seth Jennings      2013-07-10   928  {
2b2811178e8555 Seth Jennings      2013-07-10   929  	struct zswap_header *zhdr;
2b2811178e8555 Seth Jennings      2013-07-10   930  	swp_entry_t swpentry;
2b2811178e8555 Seth Jennings      2013-07-10   931  	struct zswap_tree *tree;
2b2811178e8555 Seth Jennings      2013-07-10   932  	pgoff_t offset;
2b2811178e8555 Seth Jennings      2013-07-10   933  	struct zswap_entry *entry;
2b2811178e8555 Seth Jennings      2013-07-10   934  	struct page *page;
1ec3b5fe6eec78 Barry Song         2020-12-14   935  	struct scatterlist input, output;
1ec3b5fe6eec78 Barry Song         2020-12-14   936  	struct crypto_acomp_ctx *acomp_ctx;
1ec3b5fe6eec78 Barry Song         2020-12-14   937  
2cfe0cf0b0e27b Tian Tao           2021-01-28   938  	u8 *src, *tmp;
2b2811178e8555 Seth Jennings      2013-07-10   939  	unsigned int dlen;
0ab0abcf511545 Weijie Yang        2013-11-12   940  	int ret;
2b2811178e8555 Seth Jennings      2013-07-10   941  	struct writeback_control wbc = {
2b2811178e8555 Seth Jennings      2013-07-10   942  		.sync_mode = WB_SYNC_NONE,
2b2811178e8555 Seth Jennings      2013-07-10   943  	};
2b2811178e8555 Seth Jennings      2013-07-10   944  
2cfe0cf0b0e27b Tian Tao           2021-01-28   945  	if (!zpool_can_sleep_mapped(pool)) {
2cfe0cf0b0e27b Tian Tao           2021-01-28   946  
2cfe0cf0b0e27b Tian Tao           2021-01-28   947  		tmp = kmalloc(entry->length, GFP_ATOMIC);
2cfe0cf0b0e27b Tian Tao           2021-01-28   948  		if (!tmp)
2cfe0cf0b0e27b Tian Tao           2021-01-28   949  			return -ENOMEM;
2cfe0cf0b0e27b Tian Tao           2021-01-28   950  	}
2cfe0cf0b0e27b Tian Tao           2021-01-28   951  
2b2811178e8555 Seth Jennings      2013-07-10   952  	/* extract swpentry from data */
12d79d64bfd391 Dan Streetman      2014-08-06   953  	zhdr = zpool_map_handle(pool, handle, ZPOOL_MM_RO);
2b2811178e8555 Seth Jennings      2013-07-10   954  	swpentry = zhdr->swpentry; /* here */
2b2811178e8555 Seth Jennings      2013-07-10   955  	tree = zswap_trees[swp_type(swpentry)];
2b2811178e8555 Seth Jennings      2013-07-10   956  	offset = swp_offset(swpentry);
2b2811178e8555 Seth Jennings      2013-07-10   957  
2b2811178e8555 Seth Jennings      2013-07-10   958  	/* find and ref zswap entry */
2b2811178e8555 Seth Jennings      2013-07-10   959  	spin_lock(&tree->lock);
0ab0abcf511545 Weijie Yang        2013-11-12   960  	entry = zswap_entry_find_get(&tree->rbroot, offset);
2b2811178e8555 Seth Jennings      2013-07-10   961  	if (!entry) {
2b2811178e8555 Seth Jennings      2013-07-10   962  		/* entry was invalidated */
2b2811178e8555 Seth Jennings      2013-07-10   963  		spin_unlock(&tree->lock);
068619e32ff622 Vitaly Wool        2019-09-23   964  		zpool_unmap_handle(pool, handle);
2b2811178e8555 Seth Jennings      2013-07-10   965  		return 0;
2b2811178e8555 Seth Jennings      2013-07-10   966  	}
2b2811178e8555 Seth Jennings      2013-07-10   967  	spin_unlock(&tree->lock);
2b2811178e8555 Seth Jennings      2013-07-10   968  	BUG_ON(offset != entry->offset);
2b2811178e8555 Seth Jennings      2013-07-10   969  
2b2811178e8555 Seth Jennings      2013-07-10   970  	/* try to allocate swap cache page */
2b2811178e8555 Seth Jennings      2013-07-10   971  	switch (zswap_get_swap_cache_page(swpentry, &page)) {
67d13fe846c57a Weijie Yang        2013-11-12   972  	case ZSWAP_SWAPCACHE_FAIL: /* no memory or invalidate happened */
2b2811178e8555 Seth Jennings      2013-07-10   973  		ret = -ENOMEM;
2b2811178e8555 Seth Jennings      2013-07-10   974  		goto fail;
2b2811178e8555 Seth Jennings      2013-07-10   975  
67d13fe846c57a Weijie Yang        2013-11-12   976  	case ZSWAP_SWAPCACHE_EXIST:
2b2811178e8555 Seth Jennings      2013-07-10   977  		/* page is already in the swap cache, ignore for now */
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01   978  		put_page(page);
2b2811178e8555 Seth Jennings      2013-07-10   979  		ret = -EEXIST;
2b2811178e8555 Seth Jennings      2013-07-10   980  		goto fail;
2b2811178e8555 Seth Jennings      2013-07-10   981  
2b2811178e8555 Seth Jennings      2013-07-10   982  	case ZSWAP_SWAPCACHE_NEW: /* page is locked */
2b2811178e8555 Seth Jennings      2013-07-10   983  		/* decompress */
1ec3b5fe6eec78 Barry Song         2020-12-14   984  		acomp_ctx = raw_cpu_ptr(entry->pool->acomp_ctx);
1ec3b5fe6eec78 Barry Song         2020-12-14   985  
2b2811178e8555 Seth Jennings      2013-07-10   986  		dlen = PAGE_SIZE;
068619e32ff622 Vitaly Wool        2019-09-23   987  		src = (u8 *)zhdr + sizeof(struct zswap_header);
1ec3b5fe6eec78 Barry Song         2020-12-14   988  
2cfe0cf0b0e27b Tian Tao           2021-01-28   989  		if (!zpool_can_sleep_mapped(pool)) {
2cfe0cf0b0e27b Tian Tao           2021-01-28   990  
2cfe0cf0b0e27b Tian Tao           2021-01-28  @991  			memcpy(tmp, src, entry->length);
2cfe0cf0b0e27b Tian Tao           2021-01-28   992  			src = tmp;
2cfe0cf0b0e27b Tian Tao           2021-01-28   993  
2cfe0cf0b0e27b Tian Tao           2021-01-28   994  			zpool_unmap_handle(pool, handle);
2cfe0cf0b0e27b Tian Tao           2021-01-28   995  		}
2cfe0cf0b0e27b Tian Tao           2021-01-28   996  
1ec3b5fe6eec78 Barry Song         2020-12-14   997  		mutex_lock(acomp_ctx->mutex);
1ec3b5fe6eec78 Barry Song         2020-12-14   998  		sg_init_one(&input, src, entry->length);
1ec3b5fe6eec78 Barry Song         2020-12-14   999  		sg_init_table(&output, 1);
1ec3b5fe6eec78 Barry Song         2020-12-14  1000  		sg_set_page(&output, page, PAGE_SIZE, 0);
1ec3b5fe6eec78 Barry Song         2020-12-14  1001  		acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length, dlen);
1ec3b5fe6eec78 Barry Song         2020-12-14  1002  		ret = crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait);
1ec3b5fe6eec78 Barry Song         2020-12-14  1003  		dlen = acomp_ctx->req->dlen;
1ec3b5fe6eec78 Barry Song         2020-12-14  1004  		mutex_unlock(acomp_ctx->mutex);
1ec3b5fe6eec78 Barry Song         2020-12-14  1005  
2b2811178e8555 Seth Jennings      2013-07-10  1006  		BUG_ON(ret);
2b2811178e8555 Seth Jennings      2013-07-10  1007  		BUG_ON(dlen != PAGE_SIZE);
2b2811178e8555 Seth Jennings      2013-07-10  1008  
2b2811178e8555 Seth Jennings      2013-07-10  1009  		/* page is up to date */
2b2811178e8555 Seth Jennings      2013-07-10  1010  		SetPageUptodate(page);
2b2811178e8555 Seth Jennings      2013-07-10  1011  	}
2b2811178e8555 Seth Jennings      2013-07-10  1012  
b349acc76b7f65 Weijie Yang        2013-11-12  1013  	/* move it to the tail of the inactive list after end_writeback */
b349acc76b7f65 Weijie Yang        2013-11-12  1014  	SetPageReclaim(page);
b349acc76b7f65 Weijie Yang        2013-11-12  1015  
2b2811178e8555 Seth Jennings      2013-07-10  1016  	/* start writeback */
2b2811178e8555 Seth Jennings      2013-07-10  1017  	__swap_writepage(page, &wbc, end_swap_bio_write);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1018  	put_page(page);
2b2811178e8555 Seth Jennings      2013-07-10  1019  	zswap_written_back_pages++;
2b2811178e8555 Seth Jennings      2013-07-10  1020  
2b2811178e8555 Seth Jennings      2013-07-10  1021  	spin_lock(&tree->lock);
2b2811178e8555 Seth Jennings      2013-07-10  1022  	/* drop local reference */
0ab0abcf511545 Weijie Yang        2013-11-12  1023  	zswap_entry_put(tree, entry);
2b2811178e8555 Seth Jennings      2013-07-10  1024  
2b2811178e8555 Seth Jennings      2013-07-10  1025  	/*
0ab0abcf511545 Weijie Yang        2013-11-12  1026  	* There are two possible situations for entry here:
0ab0abcf511545 Weijie Yang        2013-11-12  1027  	* (1) refcount is 1(normal case),  entry is valid and on the tree
0ab0abcf511545 Weijie Yang        2013-11-12  1028  	* (2) refcount is 0, entry is freed and not on the tree
0ab0abcf511545 Weijie Yang        2013-11-12  1029  	*     because invalidate happened during writeback
0ab0abcf511545 Weijie Yang        2013-11-12  1030  	*  search the tree and free the entry if find entry
2b2811178e8555 Seth Jennings      2013-07-10  1031  	*/
0ab0abcf511545 Weijie Yang        2013-11-12  1032  	if (entry == zswap_rb_search(&tree->rbroot, offset))
0ab0abcf511545 Weijie Yang        2013-11-12  1033  		zswap_entry_put(tree, entry);
2b2811178e8555 Seth Jennings      2013-07-10  1034  	spin_unlock(&tree->lock);
2b2811178e8555 Seth Jennings      2013-07-10  1035  
0ab0abcf511545 Weijie Yang        2013-11-12  1036  	goto end;
0ab0abcf511545 Weijie Yang        2013-11-12  1037  
0ab0abcf511545 Weijie Yang        2013-11-12  1038  	/*
0ab0abcf511545 Weijie Yang        2013-11-12  1039  	* if we get here due to ZSWAP_SWAPCACHE_EXIST
8c9e868d0d2d0e Randy Dunlap       2021-01-28  1040  	* a load may be happening concurrently.
8c9e868d0d2d0e Randy Dunlap       2021-01-28  1041  	* it is safe and okay to not free the entry.
0ab0abcf511545 Weijie Yang        2013-11-12  1042  	* if we free the entry in the following put
8c9e868d0d2d0e Randy Dunlap       2021-01-28  1043  	* it is also okay to return !0
0ab0abcf511545 Weijie Yang        2013-11-12  1044  	*/
2b2811178e8555 Seth Jennings      2013-07-10  1045  fail:
2b2811178e8555 Seth Jennings      2013-07-10  1046  	spin_lock(&tree->lock);
0ab0abcf511545 Weijie Yang        2013-11-12  1047  	zswap_entry_put(tree, entry);
2b2811178e8555 Seth Jennings      2013-07-10  1048  	spin_unlock(&tree->lock);
0ab0abcf511545 Weijie Yang        2013-11-12  1049  
0ab0abcf511545 Weijie Yang        2013-11-12  1050  end:
2cfe0cf0b0e27b Tian Tao           2021-01-28  1051  	if (zpool_can_sleep_mapped(pool))
068619e32ff622 Vitaly Wool        2019-09-23  1052  		zpool_unmap_handle(pool, handle);
2cfe0cf0b0e27b Tian Tao           2021-01-28  1053  	else
2cfe0cf0b0e27b Tian Tao           2021-01-28  1054  		kfree(tmp);
2cfe0cf0b0e27b Tian Tao           2021-01-28  1055  
2b2811178e8555 Seth Jennings      2013-07-10  1056  	return ret;
2b2811178e8555 Seth Jennings      2013-07-10  1057  }
2b2811178e8555 Seth Jennings      2013-07-10  1058  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32538 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-26 21:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 21:41 [kas:kvm-unmapped-memfd-secret 207/305] mm/zswap.c:991 zswap_writeback_entry() error: uninitialized symbol 'tmp' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.