Skip to contentSkip to conversation

kernel/events/uprobes.c:718 hprobe_consume() error: uninitialized symbol 'state'.

PATCH In review Dan Carpenter 2 participants 2 messages Oct 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 21/21 kernel/events/uprobes.c:718 hprobe_consume() error: uninitialized symbol 'state'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
head:   72a27524a4939fc0958796a46b51c1fab3729367
commit: 72a27524a4939fc0958796a46b51c1fab3729367 [21/21] uprobes: SRCU-protect uretprobe lifetime (with timeout)
config: i386-randconfig-141-20241030 (https://download.01.org/0day-ci/archive/20241030/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
kernel/events/uprobes.c:718 hprobe_consume() error: uninitialized symbol 'state'.

vim +/state +718 kernel/events/uprobes.c

72a27524a4939f Andrii Nakryiko 2024-10-23  705  static inline struct uprobe *hprobe_consume(struct hprobe *hprobe, enum hprobe_state *hstate)
72a27524a4939f Andrii Nakryiko 2024-10-23  706  {
72a27524a4939f Andrii Nakryiko 2024-10-23  707  	enum hprobe_state state;
72a27524a4939f Andrii Nakryiko 2024-10-23  708  
72a27524a4939f Andrii Nakryiko 2024-10-23  709  	*hstate = xchg(&hprobe->state, HPROBE_CONSUMED);
72a27524a4939f Andrii Nakryiko 2024-10-23  710  	switch (*hstate) {
72a27524a4939f Andrii Nakryiko 2024-10-23  711  	case HPROBE_LEASED:
72a27524a4939f Andrii Nakryiko 2024-10-23  712  	case HPROBE_STABLE:
72a27524a4939f Andrii Nakryiko 2024-10-23  713  		return hprobe->uprobe;
72a27524a4939f Andrii Nakryiko 2024-10-23  714  	case HPROBE_GONE:	/* uprobe is NULL, no SRCU */
72a27524a4939f Andrii Nakryiko 2024-10-23  715  	case HPROBE_CONSUMED:	/* uprobe was finalized already, do nothing */
72a27524a4939f Andrii Nakryiko 2024-10-23  716  		return NULL;
72a27524a4939f Andrii Nakryiko 2024-10-23  717  	default:

72a27524a4939f Andrii Nakryiko 2024-10-23 @718 WARN(1, "hprobe invalid state %d", state);

s/state/*hstate/?

72a27524a4939f Andrii Nakryiko 2024-10-23  719  		return NULL;
72a27524a4939f Andrii Nakryiko 2024-10-23  720  	}
72a27524a4939f Andrii Nakryiko 2024-10-23  721  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 31 lines · Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
head:   72a27524a4939fc0958796a46b51c1fab3729367
commit: 72a27524a4939fc0958796a46b51c1fab3729367 [21/21] uprobes: SRCU-protect uretprobe lifetime (with timeout)
config: i386-randconfig-141-20241030 (https://download.01.org/0day-ci/archive/20241030/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
kernel/events/uprobes.c:718 hprobe_consume() error: uninitialized symbol 'state'.

vim +/state +718 kernel/events/uprobes.c

72a27524a4939f Andrii Nakryiko 2024-10-23  705  static inline struct uprobe *hprobe_consume(struct hprobe *hprobe, enum hprobe_state *hstate)
72a27524a4939f Andrii Nakryiko 2024-10-23  706  {
72a27524a4939f Andrii Nakryiko 2024-10-23  707          enum hprobe_state state;
72a27524a4939f Andrii Nakryiko 2024-10-23  708
72a27524a4939f Andrii Nakryiko 2024-10-23  709          *hstate = xchg(&hprobe->state, HPROBE_CONSUMED);
72a27524a4939f Andrii Nakryiko 2024-10-23  710          switch (*hstate) {
72a27524a4939f Andrii Nakryiko 2024-10-23  711          case HPROBE_LEASED:
72a27524a4939f Andrii Nakryiko 2024-10-23  712          case HPROBE_STABLE:
72a27524a4939f Andrii Nakryiko 2024-10-23  713                  return hprobe->uprobe;
72a27524a4939f Andrii Nakryiko 2024-10-23  714          case HPROBE_GONE:       /* uprobe is NULL, no SRCU */
72a27524a4939f Andrii Nakryiko 2024-10-23  715          case HPROBE_CONSUMED:   /* uprobe was finalized already, do nothing */
72a27524a4939f Andrii Nakryiko 2024-10-23  716                  return NULL;
72a27524a4939f Andrii Nakryiko 2024-10-23  717          default:
Quoted 3 lines

72a27524a4939f Andrii Nakryiko 2024-10-23 @718 WARN(1, "hprobe invalid state %d", state);

s/state/*hstate/?

yep, oops, will send a fix soon, thank you!

Quoted 9 lines
72a27524a4939f Andrii Nakryiko 2024-10-23  719                  return NULL;
72a27524a4939f Andrii Nakryiko 2024-10-23  720          }
72a27524a4939f Andrii Nakryiko 2024-10-23  721  }

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