All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Gregory Price <gregory.price@memverge.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Gregory Price <gourry.memverge@gmail.com>,
	Rakie Kim <rakie.kim@sk.com>, Honggyu Kim <honggyu.kim@sk.com>,
	Hyeongtak Ji <hyeongtak.ji@sk.com>,
	Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>,
	Ravi Jonnalagadda <ravis.opensrc@micron.com>
Subject: [gmprice:mempolicy2_mbind2 3/13] mm/mempolicy.c:1965:40: warning: variable 'cur_node' set but not used
Date: Thu, 11 Jan 2024 10:22:30 +0800	[thread overview]
Message-ID: <202401111048.C45IHXRI-lkp@intel.com> (raw)

tree:   https://github.com/gmprice/linux mempolicy2_mbind2
head:   5dc13fbba4bf6f4a96d78938d99006aebed9613e
commit: cabe4e50f46d000ff06b4702d62be0c0a51a128c [3/13] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20240111/202401111048.C45IHXRI-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240111/202401111048.C45IHXRI-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/202401111048.C45IHXRI-lkp@intel.com/

All warnings (new ones prefixed by >>):

   mm/mempolicy.c: In function 'weighted_interleave_nid':
>> mm/mempolicy.c:1965:40: warning: variable 'cur_node' set but not used [-Wunused-but-set-variable]
    1965 |         unsigned int target, nr_nodes, cur_node;
         |                                        ^~~~~~~~
   mm/mempolicy.c: In function 'mpol_parse_str':
   mm/mempolicy.c:3236:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    3236 |                 *--flags = '=';
         |                 ~~~~~~~~~^~~~~
   mm/mempolicy.c:3118:26: note: destination object 'str' of size [0, 9223372036854775807]
    3118 | int mpol_parse_str(char *str, struct mempolicy **mpol)
         |                    ~~~~~~^~~
   mm/mempolicy.c:3236:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    3236 |                 *--flags = '=';
         |                 ~~~~~~~~~^~~~~
   mm/mempolicy.c:3118:26: note: destination object 'str' of size [0, 9223372036854775807]
    3118 | int mpol_parse_str(char *str, struct mempolicy **mpol)
         |                    ~~~~~~^~~
   mm/mempolicy.c:3236:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    3236 |                 *--flags = '=';
         |                 ~~~~~~~~~^~~~~
   mm/mempolicy.c:3118:26: note: destination object 'str' of size [0, 9223372036854775807]
    3118 | int mpol_parse_str(char *str, struct mempolicy **mpol)
         |                    ~~~~~~^~~
   mm/mempolicy.c:3236:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    3236 |                 *--flags = '=';
         |                 ~~~~~~~~~^~~~~
   mm/mempolicy.c:3118:26: note: destination object 'str' of size [0, 9223372036854775807]
    3118 | int mpol_parse_str(char *str, struct mempolicy **mpol)
         |                    ~~~~~~^~~
   mm/mempolicy.c:3236:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    3236 |                 *--flags = '=';
         |                 ~~~~~~~~~^~~~~
   mm/mempolicy.c:3118:26: note: destination object 'str' of size [0, 9223372036854775807]
    3118 | int mpol_parse_str(char *str, struct mempolicy **mpol)
         |                    ~~~~~~^~~
   mm/mempolicy.c:3236:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    3236 |                 *--flags = '=';
         |                 ~~~~~~~~~^~~~~
   mm/mempolicy.c:3118:26: note: destination object 'str' of size [0, 9223372036854775807]
    3118 | int mpol_parse_str(char *str, struct mempolicy **mpol)
         |                    ~~~~~~^~~


vim +/cur_node +1965 mm/mempolicy.c

  1961	
  1962	static unsigned int weighted_interleave_nid(struct mempolicy *pol, pgoff_t ilx)
  1963	{
  1964		nodemask_t nodemask;
> 1965		unsigned int target, nr_nodes, cur_node;
  1966		struct iw_table *table;
  1967		unsigned int weight_total = 0;
  1968		u8 weight;
  1969		int nid;
  1970	
  1971		nr_nodes = read_once_policy_nodemask(pol, &nodemask);
  1972		if (!nr_nodes)
  1973			return numa_node_id();
  1974	
  1975		rcu_read_lock();
  1976		table = rcu_dereference(iw_table);
  1977		/* calculate the total weight */
  1978		for_each_node_mask(nid, nodemask)
  1979			weight_total += table->weights[nid];
  1980	
  1981		/* Calculate the node offset based on totals */
  1982		target = ilx % weight_total;
  1983		nid = first_node(nodemask);
  1984		cur_node = 0;
  1985		while (target) {
  1986			weight = table->weights[nid];
  1987			if (target < weight)
  1988				break;
  1989			target -= weight;
  1990			nid = next_node_in(nid, nodemask);
  1991		}
  1992		rcu_read_unlock();
  1993		return nid;
  1994	}
  1995	

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

                 reply	other threads:[~2024-01-11  2:23 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=202401111048.C45IHXRI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gourry.memverge@gmail.com \
    --cc=gregory.price@memverge.com \
    --cc=honggyu.kim@sk.com \
    --cc=hyeongtak.ji@sk.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rakie.kim@sk.com \
    --cc=ravis.opensrc@micron.com \
    --cc=sthanneeru.opensrc@micron.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 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.