All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v7 3/5] counter: Add character device interface
Date: Sun, 27 Dec 2020 04:00:19 +0800	[thread overview]
Message-ID: <202012270332.6EfBbBfK-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <57bc509273bf288d74835e6ebdaebf27b4991888.1608935587.git.vilhelm.gray@gmail.com>
References: <57bc509273bf288d74835e6ebdaebf27b4991888.1608935587.git.vilhelm.gray@gmail.com>
TO: William Breathitt Gray <vilhelm.gray@gmail.com>

Hi William,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20201223]
[cannot apply to stm32/stm32-next linux/master v5.10]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/William-Breathitt-Gray/Introduce-the-Counter-character-device-interface/20201226-082226
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 61d791365b72a89062fbbea69aa61479476da946
:::::: branch date: 20 hours ago
:::::: commit date: 20 hours ago
config: i386-randconfig-m021-20201226 (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:
drivers/counter/counter-chrdev.c:254 counter_add_watch() error: uninitialized symbol 'num_ext'.
drivers/counter/counter-chrdev.c:258 counter_add_watch() error: uninitialized symbol 'ext'.

vim +/num_ext +254 drivers/counter/counter-chrdev.c

0eae595bb599eaa William Breathitt Gray 2020-12-25  169  
0eae595bb599eaa William Breathitt Gray 2020-12-25  170  static int counter_add_watch(struct counter_device *const counter,
0eae595bb599eaa William Breathitt Gray 2020-12-25  171  			     const unsigned long arg)
0eae595bb599eaa William Breathitt Gray 2020-12-25  172  {
0eae595bb599eaa William Breathitt Gray 2020-12-25  173  	void __user *const uwatch = (void __user *)arg;
0eae595bb599eaa William Breathitt Gray 2020-12-25  174  	struct counter_watch watch;
0eae595bb599eaa William Breathitt Gray 2020-12-25  175  	struct counter_comp_node comp_node = {0};
0eae595bb599eaa William Breathitt Gray 2020-12-25  176  	size_t parent, id;
0eae595bb599eaa William Breathitt Gray 2020-12-25  177  	struct counter_comp *ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  178  	size_t num_ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  179  	int err;
0eae595bb599eaa William Breathitt Gray 2020-12-25  180  
0eae595bb599eaa William Breathitt Gray 2020-12-25  181  	if (copy_from_user(&watch, uwatch, sizeof(watch)))
0eae595bb599eaa William Breathitt Gray 2020-12-25  182  		return -EFAULT;
0eae595bb599eaa William Breathitt Gray 2020-12-25  183  
0eae595bb599eaa William Breathitt Gray 2020-12-25  184  	if (watch.component.type == COUNTER_COMPONENT_NONE)
0eae595bb599eaa William Breathitt Gray 2020-12-25  185  		goto no_component;
0eae595bb599eaa William Breathitt Gray 2020-12-25  186  
0eae595bb599eaa William Breathitt Gray 2020-12-25  187  	parent = watch.component.parent;
0eae595bb599eaa William Breathitt Gray 2020-12-25  188  
0eae595bb599eaa William Breathitt Gray 2020-12-25  189  	/* Configure parent component info for comp node */
0eae595bb599eaa William Breathitt Gray 2020-12-25  190  	switch (watch.component.scope) {
0eae595bb599eaa William Breathitt Gray 2020-12-25  191  	case COUNTER_SCOPE_DEVICE:
0eae595bb599eaa William Breathitt Gray 2020-12-25  192  		ext = counter->ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  193  		num_ext = counter->num_ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  194  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  195  	case COUNTER_SCOPE_SIGNAL:
0eae595bb599eaa William Breathitt Gray 2020-12-25  196  		if (parent >= counter->num_signals)
0eae595bb599eaa William Breathitt Gray 2020-12-25  197  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  198  		parent = array_index_nospec(parent, counter->num_signals);
0eae595bb599eaa William Breathitt Gray 2020-12-25  199  
0eae595bb599eaa William Breathitt Gray 2020-12-25  200  		comp_node.parent = counter->signals + parent;
0eae595bb599eaa William Breathitt Gray 2020-12-25  201  
0eae595bb599eaa William Breathitt Gray 2020-12-25  202  		ext = counter->signals[parent].ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  203  		num_ext = counter->signals[parent].num_ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  204  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  205  	case COUNTER_SCOPE_COUNT:
0eae595bb599eaa William Breathitt Gray 2020-12-25  206  		if (parent >= counter->num_counts)
0eae595bb599eaa William Breathitt Gray 2020-12-25  207  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  208  		parent = array_index_nospec(parent, counter->num_counts);
0eae595bb599eaa William Breathitt Gray 2020-12-25  209  
0eae595bb599eaa William Breathitt Gray 2020-12-25  210  		comp_node.parent = counter->counts + parent;
0eae595bb599eaa William Breathitt Gray 2020-12-25  211  
0eae595bb599eaa William Breathitt Gray 2020-12-25  212  		ext = counter->counts[parent].ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  213  		num_ext = counter->counts[parent].num_ext;
0eae595bb599eaa William Breathitt Gray 2020-12-25  214  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  215  	}
0eae595bb599eaa William Breathitt Gray 2020-12-25  216  
0eae595bb599eaa William Breathitt Gray 2020-12-25  217  	id = watch.component.id;
0eae595bb599eaa William Breathitt Gray 2020-12-25  218  
0eae595bb599eaa William Breathitt Gray 2020-12-25  219  	/* Configure component info for comp node */
0eae595bb599eaa William Breathitt Gray 2020-12-25  220  	switch (watch.component.type) {
0eae595bb599eaa William Breathitt Gray 2020-12-25  221  	case COUNTER_COMPONENT_SIGNAL:
0eae595bb599eaa William Breathitt Gray 2020-12-25  222  		if (watch.component.scope != COUNTER_SCOPE_SIGNAL)
0eae595bb599eaa William Breathitt Gray 2020-12-25  223  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  224  
0eae595bb599eaa William Breathitt Gray 2020-12-25  225  		comp_node.comp.type = COUNTER_COMP_SIGNAL_LEVEL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  226  		comp_node.comp.signal_u32_read = counter->ops->signal_read;
0eae595bb599eaa William Breathitt Gray 2020-12-25  227  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  228  	case COUNTER_COMPONENT_COUNT:
0eae595bb599eaa William Breathitt Gray 2020-12-25  229  		if (watch.component.scope != COUNTER_SCOPE_COUNT)
0eae595bb599eaa William Breathitt Gray 2020-12-25  230  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  231  
0eae595bb599eaa William Breathitt Gray 2020-12-25  232  		comp_node.comp.type = COUNTER_COMP_U64;
0eae595bb599eaa William Breathitt Gray 2020-12-25  233  		comp_node.comp.count_u64_read = counter->ops->count_read;
0eae595bb599eaa William Breathitt Gray 2020-12-25  234  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  235  	case COUNTER_COMPONENT_FUNCTION:
0eae595bb599eaa William Breathitt Gray 2020-12-25  236  		if (watch.component.scope != COUNTER_SCOPE_COUNT)
0eae595bb599eaa William Breathitt Gray 2020-12-25  237  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  238  
0eae595bb599eaa William Breathitt Gray 2020-12-25  239  		comp_node.comp.type = COUNTER_COMP_FUNCTION;
0eae595bb599eaa William Breathitt Gray 2020-12-25  240  		comp_node.comp.count_u32_read = counter->ops->function_read;
0eae595bb599eaa William Breathitt Gray 2020-12-25  241  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  242  	case COUNTER_COMPONENT_SYNAPSE_ACTION:
0eae595bb599eaa William Breathitt Gray 2020-12-25  243  		if (watch.component.scope != COUNTER_SCOPE_COUNT)
0eae595bb599eaa William Breathitt Gray 2020-12-25  244  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  245  		if (id >= counter->counts[parent].num_synapses)
0eae595bb599eaa William Breathitt Gray 2020-12-25  246  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  247  		id = array_index_nospec(id, counter->counts[parent].num_synapses);
0eae595bb599eaa William Breathitt Gray 2020-12-25  248  
0eae595bb599eaa William Breathitt Gray 2020-12-25  249  		comp_node.comp.type = COUNTER_COMP_SYNAPSE_ACTION;
0eae595bb599eaa William Breathitt Gray 2020-12-25  250  		comp_node.comp.action_read = counter->ops->action_read;
0eae595bb599eaa William Breathitt Gray 2020-12-25  251  		comp_node.comp.priv = counter->counts[parent].synapses + id;
0eae595bb599eaa William Breathitt Gray 2020-12-25  252  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  253  	case COUNTER_COMPONENT_EXTENSION:
0eae595bb599eaa William Breathitt Gray 2020-12-25 @254  		if (id >= num_ext)
0eae595bb599eaa William Breathitt Gray 2020-12-25  255  			return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  256  		id = array_index_nospec(id, num_ext);
0eae595bb599eaa William Breathitt Gray 2020-12-25  257  
0eae595bb599eaa William Breathitt Gray 2020-12-25 @258  		comp_node.comp = ext[id];
0eae595bb599eaa William Breathitt Gray 2020-12-25  259  		break;
0eae595bb599eaa William Breathitt Gray 2020-12-25  260  	default:
0eae595bb599eaa William Breathitt Gray 2020-12-25  261  		return -EINVAL;
0eae595bb599eaa William Breathitt Gray 2020-12-25  262  	}
0eae595bb599eaa William Breathitt Gray 2020-12-25  263  	/* Check if any read callback is set; this is part of a union */
0eae595bb599eaa William Breathitt Gray 2020-12-25  264  	if (!comp_node.comp.count_u8_read)
0eae595bb599eaa William Breathitt Gray 2020-12-25  265  		return -EOPNOTSUPP;
0eae595bb599eaa William Breathitt Gray 2020-12-25  266  
0eae595bb599eaa William Breathitt Gray 2020-12-25  267  no_component:
0eae595bb599eaa William Breathitt Gray 2020-12-25  268  	if (counter->ops->watch_validate) {
0eae595bb599eaa William Breathitt Gray 2020-12-25  269  		err = counter->ops->watch_validate(counter, &watch);
0eae595bb599eaa William Breathitt Gray 2020-12-25  270  		if (err < 0)
0eae595bb599eaa William Breathitt Gray 2020-12-25  271  			return err;
0eae595bb599eaa William Breathitt Gray 2020-12-25  272  	}
0eae595bb599eaa William Breathitt Gray 2020-12-25  273  
0eae595bb599eaa William Breathitt Gray 2020-12-25  274  	comp_node.component = watch.component;
0eae595bb599eaa William Breathitt Gray 2020-12-25  275  
0eae595bb599eaa William Breathitt Gray 2020-12-25  276  	return counter_set_event_node(counter, &watch, &comp_node);
0eae595bb599eaa William Breathitt Gray 2020-12-25  277  }
0eae595bb599eaa William Breathitt Gray 2020-12-25  278  

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

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

             reply	other threads:[~2020-12-26 20:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26 20:00 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-26  0:15 [PATCH v7 0/5] Introduce the Counter character device interface William Breathitt Gray
2020-12-26  0:15 ` [PATCH v7 3/5] counter: Add " William Breathitt Gray
2020-12-26  0:15   ` William Breathitt Gray
2020-12-30 15:04   ` Jonathan Cameron
2020-12-30 15:04     ` Jonathan Cameron
2021-02-12  6:32     ` William Breathitt Gray
2021-02-12  6:32       ` William Breathitt Gray
2020-12-30 21:36   ` David Lechner
2020-12-30 21:36     ` David Lechner
2021-01-30  4:59     ` William Breathitt Gray
2021-01-30  4:59       ` William Breathitt Gray
2021-01-04 18:15   ` Dan Carpenter
2021-01-04 18:15     ` Dan Carpenter
2021-01-28  9:01   ` Oleksij Rempel
2021-01-28  9:01     ` Oleksij Rempel
2021-01-30  5:15     ` William Breathitt Gray
2021-01-30  5:15       ` William Breathitt Gray

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=202012270332.6EfBbBfK-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.