oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [isilence:zcrx/next 10/27] io_uring/zc_rx.c:85:18: warning: variable 'nr_pages' is uninitialized when used here
Date: Wed, 15 May 2024 14:57:39 +0800	[thread overview]
Message-ID: <202405151454.iFf5xfqH-lkp@intel.com> (raw)

tree:   https://github.com/isilence/linux zcrx/next
head:   8f99f44fc1fabf943cf0d1989f0afdff15e064e8
commit: 0ce40e0dbed2309622ada5e3c5128f22338602c4 [10/27] io_uring/zcrx: get rid of registered buffers + region format
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20240515/202405151454.iFf5xfqH-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project b910bebc300dafb30569cecc3017b446ea8eafa0)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240515/202405151454.iFf5xfqH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405151454.iFf5xfqH-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from io_uring/zc_rx.c:5:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> io_uring/zc_rx.c:85:18: warning: variable 'nr_pages' is uninitialized when used here [-Wuninitialized]
      85 |         pool->nr_bufs = nr_pages;
         |                         ^~~~~~~~
   io_uring/zc_rx.c:64:22: note: initialize the variable 'nr_pages' to silence this warning
      64 |         int i, ret, nr_pages;
         |                             ^
         |                              = 0
   2 warnings generated.


vim +/nr_pages +85 io_uring/zc_rx.c

    57	
    58	static int io_zc_rx_create_pool(struct io_ring_ctx *ctx,
    59					struct io_zc_rx_ifq *ifq,
    60					struct io_zc_rx_pool **res,
    61					struct io_uring_zc_rx_region_reg *region)
    62	{
    63		struct io_zc_rx_pool *pool;
    64		int i, ret, nr_pages;
    65		struct iovec iov;
    66	
    67		if (region->flags || region->region_id)
    68			return -EINVAL;
    69		if (region->resv2[0] || region->resv2[1] || region->resv2[2])
    70			return -EINVAL;
    71		if (region->addr & ~PAGE_MASK || region->len & ~PAGE_MASK)
    72			return -EINVAL;
    73	
    74		iov.iov_base = u64_to_user_ptr(region->addr);
    75		iov.iov_len = region->len;
    76		ret = io_buffer_validate(&iov);
    77		if (ret)
    78			return ret;
    79	
    80		ret = -ENOMEM;
    81		pool = kmalloc(sizeof(*pool), GFP_KERNEL);
    82		if (!pool)
    83			goto err;
    84	
  > 85		pool->nr_bufs = nr_pages;
    86		pool->pages = io_pin_pages((unsigned long)region->addr, region->len,
    87					   &nr_pages);
    88		if (!pool->pages)
    89			goto err;
    90	
    91		pool->bufs = kvmalloc_array(nr_pages, sizeof(pool->bufs[0]), GFP_KERNEL);
    92		if (!pool->bufs)
    93			goto err;
    94	
    95		pool->freelist = kvmalloc_array(nr_pages, sizeof(pool->freelist[0]),
    96						GFP_KERNEL);
    97		if (!pool->freelist)
    98			goto err;
    99	
   100		for (i = 0; i < nr_pages; i++) {
   101			struct net_iov *niov = &pool->bufs[i].niov;
   102	
   103			memset(niov, 0, sizeof(*niov));
   104			atomic_long_set(&niov->pp_ref_count, 0);
   105			pool->freelist[i] = i;
   106		}
   107	
   108		pool->free_count = nr_pages;
   109		pool->ifq = ifq;
   110		/* we're only supporting one region per ifq for now */
   111		pool->pool_id = 0;
   112		region->region_id = pool->pool_id;
   113		spin_lock_init(&pool->freelist_lock);
   114		*res = pool;
   115		return 0;
   116	err:
   117		if (pool)
   118			io_zc_rx_free_pool(pool);
   119		return ret;
   120	}
   121	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-05-15  6:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202405151454.iFf5xfqH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=asml.silence@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).