Skip to contentSkip to conversation

kernel/bpf/states.c:557 same_refs() error: memcmp() '&a->refs[i]->ptr' too small (4 vs 8)

PATCH kernel test robot 1 participant 1 message Nov 22

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Unfiltered warning: this smatch report is sent as-is and has not been reviewed for false positives, so please treat it with due skepticism.

BCC: [email protected]
CC: [email protected]
TO: Kumar Kartikeya Dwivedi <[email protected]>

tree:   https://github.com/kkdwivedi/linux fermata
head:   7f7b1fb0e49ec9ac76f5d9f32824c34f601bd438
commit: 594aa7bcd085fc1bee0df72e792e57426e710157 [187/284] bpf: Add reference-owned slot arrays to verifier state

:::::: branch date: 76 minutes ago
:::::: commit date: 5 hours ago
config: csky-randconfig-2200-20261122 (https://download.01.org/0day-ci/archive/20261122/[email protected]/config)
compiler: csky-linux-gcc (GCC) 9.5.0
smatch: v0.5.0-9187-g5189e3fb

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/bpf/states.c:557 same_refs() error: memcmp() '&a->refs[i]->ptr' too small (4 vs 8) kernel/bpf/states.c:557 same_refs() error: memcmp() '&b->refs[i]->ptr' too small (4 vs 8)

vim +557 kernel/bpf/states.c

594aa7bcd085fc Kumar Kartikeya Dwivedi 2026-09-29  550  
a03670bf0cf38b Alexei Starovoitov      2026-11-20  551  static bool same_refs(const struct bpf_verifier_state *a, const struct bpf_verifier_state *b)
a03670bf0cf38b Alexei Starovoitov      2026-11-20  552  {
a03670bf0cf38b Alexei Starovoitov      2026-11-20  553  	u32 i;
a03670bf0cf38b Alexei Starovoitov      2026-11-20  554  
3cd88d44c75b33 Kumar Kartikeya Dwivedi 2026-11-13  555  	for (i = 0; i < a->acquired_refs; i++) {
a03670bf0cf38b Alexei Starovoitov      2026-11-20  556  		if (a->refs[i].type != b->refs[i].type || a->refs[i].id != b->refs[i].id ||
a03670bf0cf38b Alexei Starovoitov      2026-11-20 @557  		    memcmp(&a->refs[i].ptr, &b->refs[i].ptr, sizeof(u64)))
a03670bf0cf38b Alexei Starovoitov      2026-11-20  558  			return false;
3cd88d44c75b33 Kumar Kartikeya Dwivedi 2026-11-13  559  		/* a state doesn't stand for one where another frame is to release it */
3cd88d44c75b33 Kumar Kartikeya Dwivedi 2026-11-13  560  		if (a->refs[i].frameno != b->refs[i].frameno)
3cd88d44c75b33 Kumar Kartikeya Dwivedi 2026-11-13  561  			return false;
2b95051722e6ed Kumar Kartikeya Dwivedi 2026-11-13  562  		/* or where a frame above the owner got it in another argument */
2b95051722e6ed Kumar Kartikeya Dwivedi 2026-11-13  563  		if (memcmp(a->refs[i].args, b->refs[i].args, sizeof(a->refs[i].args)))
2b95051722e6ed Kumar Kartikeya Dwivedi 2026-11-13  564  			return false;
594aa7bcd085fc Kumar Kartikeya Dwivedi 2026-09-29  565  		if (!same_ref_slots(&a->refs[i], &b->refs[i]))
594aa7bcd085fc Kumar Kartikeya Dwivedi 2026-09-29  566  			return false;
3cd88d44c75b33 Kumar Kartikeya Dwivedi 2026-11-13  567  	}
a03670bf0cf38b Alexei Starovoitov      2026-11-20  568  	return true;
a03670bf0cf38b Alexei Starovoitov      2026-11-20  569  }

a03670bf0cf38b Alexei Starovoitov 2026-11-20 570

:::::: The code at line 557 was first introduced by commit
:::::: a03670bf0cf38b9429887b8d8f9334e1fd1b3e95 bpf: Compare states by join_key, then by value

:::::: TO: Alexei Starovoitov <[email protected]>
:::::: CC: Alexei Starovoitov <[email protected]>

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