All of lore.kernel.org
 help / color / mirror / Atom feed
* [openeuler:OLK-5.10 2610/2610] fs/fscache/cookie.c:239 fscache_hash_cookie() error: uninitialized symbol 'cursor'.
@ 2025-01-04  6:06 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-01-04  6:06 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: kernel@openeuler.org
TO: Baokun Li <libaokun1@huawei.com>

tree:   https://gitee.com/openeuler/kernel.git OLK-5.10
head:   d51fb86ce6a3a3e59d7cba58738b63903b8cb37c
commit: f4b00ea196389e4fc82cda38e0d6cd3ff8947673 [2610/2610] fscache: add a waiting mechanism when duplicate cookies are detected
:::::: branch date: 22 hours ago
:::::: commit date: 10 days ago
config: x86_64-randconfig-161-20241231 (https://download.01.org/0day-ci/archive/20250104/202501041345.chdxFNo6-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202501041345.chdxFNo6-lkp@intel.com/

New smatch warnings:
fs/fscache/cookie.c:239 fscache_hash_cookie() error: uninitialized symbol 'cursor'.
fs/fscache/cookie.c:532 fscache_alloc_object() warn: argument 2 to %lx specifier is cast from pointer
fs/fscache/cookie.c:588 fscache_attach_object() warn: argument 2 to %lx specifier is cast from pointer

Old smatch warnings:
fs/fscache/cookie.c:532 fscache_alloc_object() warn: argument 3 to %lx specifier is cast from pointer
fs/fscache/cookie.c:588 fscache_attach_object() warn: argument 3 to %lx specifier is cast from pointer

vim +/cursor +239 fs/fscache/cookie.c

f4b00ea196389e4 Zizhi Wo      2024-12-25  200  
ec0328e46d6e5d0 David Howells 2018-04-04  201  /*
ec0328e46d6e5d0 David Howells 2018-04-04  202   * Attempt to insert the new cookie into the hash.  If there's a collision, we
ec0328e46d6e5d0 David Howells 2018-04-04  203   * return the old cookie if it's not in use and an error otherwise.
ec0328e46d6e5d0 David Howells 2018-04-04  204   */
ec0328e46d6e5d0 David Howells 2018-04-04  205  struct fscache_cookie *fscache_hash_cookie(struct fscache_cookie *candidate)
ec0328e46d6e5d0 David Howells 2018-04-04  206  {
ec0328e46d6e5d0 David Howells 2018-04-04  207  	struct fscache_cookie *cursor;
ec0328e46d6e5d0 David Howells 2018-04-04  208  	struct hlist_bl_head *h;
ec0328e46d6e5d0 David Howells 2018-04-04  209  	struct hlist_bl_node *p;
ec0328e46d6e5d0 David Howells 2018-04-04  210  	unsigned int bucket;
ec0328e46d6e5d0 David Howells 2018-04-04  211  
ec0328e46d6e5d0 David Howells 2018-04-04  212  	bucket = candidate->key_hash & (ARRAY_SIZE(fscache_cookie_hash) - 1);
ec0328e46d6e5d0 David Howells 2018-04-04  213  	h = &fscache_cookie_hash[bucket];
ec0328e46d6e5d0 David Howells 2018-04-04  214  
ec0328e46d6e5d0 David Howells 2018-04-04  215  	hlist_bl_lock(h);
ec0328e46d6e5d0 David Howells 2018-04-04  216  	hlist_bl_for_each_entry(cursor, p, h, hash_link) {
f4b00ea196389e4 Zizhi Wo      2024-12-25  217  		if (fscache_compare_cookie(candidate, cursor) == 0) {
f4b00ea196389e4 Zizhi Wo      2024-12-25  218  			if (!test_bit(FSCACHE_COOKIE_RELINQUISHED, &cursor->flags))
ec0328e46d6e5d0 David Howells 2018-04-04  219  				goto collision;
f4b00ea196389e4 Zizhi Wo      2024-12-25  220  			cursor->collision = candidate;
f4b00ea196389e4 Zizhi Wo      2024-12-25  221  			set_bit(FSCACHE_COOKIE_ACQUIRE_PENDING, &candidate->flags);
f4b00ea196389e4 Zizhi Wo      2024-12-25  222  			break;
f4b00ea196389e4 Zizhi Wo      2024-12-25  223  		}
ec0328e46d6e5d0 David Howells 2018-04-04  224  	}
ec0328e46d6e5d0 David Howells 2018-04-04  225  
ec0328e46d6e5d0 David Howells 2018-04-04  226  	__set_bit(FSCACHE_COOKIE_ACQUIRED, &candidate->flags);
ec0328e46d6e5d0 David Howells 2018-04-04  227  	fscache_cookie_get(candidate->parent, fscache_cookie_get_acquire_parent);
ec0328e46d6e5d0 David Howells 2018-04-04  228  	atomic_inc(&candidate->parent->n_children);
ec0328e46d6e5d0 David Howells 2018-04-04  229  	hlist_bl_add_head(&candidate->hash_link, h);
ec0328e46d6e5d0 David Howells 2018-04-04  230  	hlist_bl_unlock(h);
f4b00ea196389e4 Zizhi Wo      2024-12-25  231  
f4b00ea196389e4 Zizhi Wo      2024-12-25  232  	if (fscache_is_acquire_pending(candidate) &&
f4b00ea196389e4 Zizhi Wo      2024-12-25  233  	    fscache_wait_on_cookie_collision(candidate)) {
f4b00ea196389e4 Zizhi Wo      2024-12-25  234  		fscache_cookie_put(candidate->parent, fscache_cookie_put_acquire_nobufs);
f4b00ea196389e4 Zizhi Wo      2024-12-25  235  		atomic_dec(&candidate->parent->n_children);
f4b00ea196389e4 Zizhi Wo      2024-12-25  236  		hlist_bl_lock(h);
f4b00ea196389e4 Zizhi Wo      2024-12-25  237  		hlist_bl_del(&candidate->hash_link);
f4b00ea196389e4 Zizhi Wo      2024-12-25  238  		if (fscache_is_acquire_pending(candidate))
f4b00ea196389e4 Zizhi Wo      2024-12-25 @239  			cursor->collision = NULL;
f4b00ea196389e4 Zizhi Wo      2024-12-25  240  		hlist_bl_unlock(h);
f4b00ea196389e4 Zizhi Wo      2024-12-25  241  		pr_err("Wait duplicate cookie unhashed interrupted\n");
f4b00ea196389e4 Zizhi Wo      2024-12-25  242  		return NULL;
f4b00ea196389e4 Zizhi Wo      2024-12-25  243  	}
ec0328e46d6e5d0 David Howells 2018-04-04  244  	return candidate;
ec0328e46d6e5d0 David Howells 2018-04-04  245  
ec0328e46d6e5d0 David Howells 2018-04-04  246  collision:
ec0328e46d6e5d0 David Howells 2018-04-04  247  	if (test_and_set_bit(FSCACHE_COOKIE_ACQUIRED, &cursor->flags)) {
ec0328e46d6e5d0 David Howells 2018-04-04  248  		trace_fscache_cookie(cursor, fscache_cookie_collision,
ec0328e46d6e5d0 David Howells 2018-04-04  249  				     atomic_read(&cursor->usage));
ec0328e46d6e5d0 David Howells 2018-04-04  250  		fscache_print_cookie(cursor, 'O');
ec0328e46d6e5d0 David Howells 2018-04-04  251  		fscache_print_cookie(candidate, 'N');
ec0328e46d6e5d0 David Howells 2018-04-04  252  		hlist_bl_unlock(h);
f4b00ea196389e4 Zizhi Wo      2024-12-25  253  		pr_err("Duplicate cookie detected\n");
ec0328e46d6e5d0 David Howells 2018-04-04  254  		return NULL;
ec0328e46d6e5d0 David Howells 2018-04-04  255  	}
ec0328e46d6e5d0 David Howells 2018-04-04  256  
ec0328e46d6e5d0 David Howells 2018-04-04  257  	fscache_cookie_get(cursor, fscache_cookie_get_reacquire);
ec0328e46d6e5d0 David Howells 2018-04-04  258  	hlist_bl_unlock(h);
ec0328e46d6e5d0 David Howells 2018-04-04  259  	return cursor;
ec0328e46d6e5d0 David Howells 2018-04-04  260  }
ec0328e46d6e5d0 David Howells 2018-04-04  261  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [openeuler:OLK-5.10 2610/2610] fs/fscache/cookie.c:239 fscache_hash_cookie() error: uninitialized symbol 'cursor'.
@ 2024-12-31 14:43 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-12-31 14:43 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: kernel@openeuler.org
TO: Baokun Li <libaokun1@huawei.com>

tree:   https://gitee.com/openeuler/kernel.git OLK-5.10
head:   55bf638d3d29c53ddd64ed89efda8b70b47ccbbc
commit: f4b00ea196389e4fc82cda38e0d6cd3ff8947673 [2610/2610] fscache: add a waiting mechanism when duplicate cookies are detected
:::::: branch date: 6 hours ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-161-20241231 (https://download.01.org/0day-ci/archive/20241231/202412312254.AFHU6TIA-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202412312254.AFHU6TIA-lkp@intel.com/

New smatch warnings:
fs/fscache/cookie.c:239 fscache_hash_cookie() error: uninitialized symbol 'cursor'.
fs/fscache/cookie.c:532 fscache_alloc_object() warn: argument 2 to %lx specifier is cast from pointer
fs/fscache/cookie.c:588 fscache_attach_object() warn: argument 2 to %lx specifier is cast from pointer

Old smatch warnings:
fs/fscache/cookie.c:532 fscache_alloc_object() warn: argument 3 to %lx specifier is cast from pointer
fs/fscache/cookie.c:588 fscache_attach_object() warn: argument 3 to %lx specifier is cast from pointer

vim +/cursor +239 fs/fscache/cookie.c

f4b00ea196389e Zizhi Wo      2024-12-25  200  
ec0328e46d6e5d David Howells 2018-04-04  201  /*
ec0328e46d6e5d David Howells 2018-04-04  202   * Attempt to insert the new cookie into the hash.  If there's a collision, we
ec0328e46d6e5d David Howells 2018-04-04  203   * return the old cookie if it's not in use and an error otherwise.
ec0328e46d6e5d David Howells 2018-04-04  204   */
ec0328e46d6e5d David Howells 2018-04-04  205  struct fscache_cookie *fscache_hash_cookie(struct fscache_cookie *candidate)
ec0328e46d6e5d David Howells 2018-04-04  206  {
ec0328e46d6e5d David Howells 2018-04-04  207  	struct fscache_cookie *cursor;
ec0328e46d6e5d David Howells 2018-04-04  208  	struct hlist_bl_head *h;
ec0328e46d6e5d David Howells 2018-04-04  209  	struct hlist_bl_node *p;
ec0328e46d6e5d David Howells 2018-04-04  210  	unsigned int bucket;
ec0328e46d6e5d David Howells 2018-04-04  211  
ec0328e46d6e5d David Howells 2018-04-04  212  	bucket = candidate->key_hash & (ARRAY_SIZE(fscache_cookie_hash) - 1);
ec0328e46d6e5d David Howells 2018-04-04  213  	h = &fscache_cookie_hash[bucket];
ec0328e46d6e5d David Howells 2018-04-04  214  
ec0328e46d6e5d David Howells 2018-04-04  215  	hlist_bl_lock(h);
ec0328e46d6e5d David Howells 2018-04-04  216  	hlist_bl_for_each_entry(cursor, p, h, hash_link) {
f4b00ea196389e Zizhi Wo      2024-12-25  217  		if (fscache_compare_cookie(candidate, cursor) == 0) {
f4b00ea196389e Zizhi Wo      2024-12-25  218  			if (!test_bit(FSCACHE_COOKIE_RELINQUISHED, &cursor->flags))
ec0328e46d6e5d David Howells 2018-04-04  219  				goto collision;
f4b00ea196389e Zizhi Wo      2024-12-25  220  			cursor->collision = candidate;
f4b00ea196389e Zizhi Wo      2024-12-25  221  			set_bit(FSCACHE_COOKIE_ACQUIRE_PENDING, &candidate->flags);
f4b00ea196389e Zizhi Wo      2024-12-25  222  			break;
f4b00ea196389e Zizhi Wo      2024-12-25  223  		}
ec0328e46d6e5d David Howells 2018-04-04  224  	}
ec0328e46d6e5d David Howells 2018-04-04  225  
ec0328e46d6e5d David Howells 2018-04-04  226  	__set_bit(FSCACHE_COOKIE_ACQUIRED, &candidate->flags);
ec0328e46d6e5d David Howells 2018-04-04  227  	fscache_cookie_get(candidate->parent, fscache_cookie_get_acquire_parent);
ec0328e46d6e5d David Howells 2018-04-04  228  	atomic_inc(&candidate->parent->n_children);
ec0328e46d6e5d David Howells 2018-04-04  229  	hlist_bl_add_head(&candidate->hash_link, h);
ec0328e46d6e5d David Howells 2018-04-04  230  	hlist_bl_unlock(h);
f4b00ea196389e Zizhi Wo      2024-12-25  231  
f4b00ea196389e Zizhi Wo      2024-12-25  232  	if (fscache_is_acquire_pending(candidate) &&
f4b00ea196389e Zizhi Wo      2024-12-25  233  	    fscache_wait_on_cookie_collision(candidate)) {
f4b00ea196389e Zizhi Wo      2024-12-25  234  		fscache_cookie_put(candidate->parent, fscache_cookie_put_acquire_nobufs);
f4b00ea196389e Zizhi Wo      2024-12-25  235  		atomic_dec(&candidate->parent->n_children);
f4b00ea196389e Zizhi Wo      2024-12-25  236  		hlist_bl_lock(h);
f4b00ea196389e Zizhi Wo      2024-12-25  237  		hlist_bl_del(&candidate->hash_link);
f4b00ea196389e Zizhi Wo      2024-12-25  238  		if (fscache_is_acquire_pending(candidate))
f4b00ea196389e Zizhi Wo      2024-12-25 @239  			cursor->collision = NULL;
f4b00ea196389e Zizhi Wo      2024-12-25  240  		hlist_bl_unlock(h);
f4b00ea196389e Zizhi Wo      2024-12-25  241  		pr_err("Wait duplicate cookie unhashed interrupted\n");
f4b00ea196389e Zizhi Wo      2024-12-25  242  		return NULL;
f4b00ea196389e Zizhi Wo      2024-12-25  243  	}
ec0328e46d6e5d David Howells 2018-04-04  244  	return candidate;
ec0328e46d6e5d David Howells 2018-04-04  245  
ec0328e46d6e5d David Howells 2018-04-04  246  collision:
ec0328e46d6e5d David Howells 2018-04-04  247  	if (test_and_set_bit(FSCACHE_COOKIE_ACQUIRED, &cursor->flags)) {
ec0328e46d6e5d David Howells 2018-04-04  248  		trace_fscache_cookie(cursor, fscache_cookie_collision,
ec0328e46d6e5d David Howells 2018-04-04  249  				     atomic_read(&cursor->usage));
ec0328e46d6e5d David Howells 2018-04-04  250  		fscache_print_cookie(cursor, 'O');
ec0328e46d6e5d David Howells 2018-04-04  251  		fscache_print_cookie(candidate, 'N');
ec0328e46d6e5d David Howells 2018-04-04  252  		hlist_bl_unlock(h);
f4b00ea196389e Zizhi Wo      2024-12-25  253  		pr_err("Duplicate cookie detected\n");
ec0328e46d6e5d David Howells 2018-04-04  254  		return NULL;
ec0328e46d6e5d David Howells 2018-04-04  255  	}
ec0328e46d6e5d David Howells 2018-04-04  256  
ec0328e46d6e5d David Howells 2018-04-04  257  	fscache_cookie_get(cursor, fscache_cookie_get_reacquire);
ec0328e46d6e5d David Howells 2018-04-04  258  	hlist_bl_unlock(h);
ec0328e46d6e5d David Howells 2018-04-04  259  	return cursor;
ec0328e46d6e5d David Howells 2018-04-04  260  }
ec0328e46d6e5d David Howells 2018-04-04  261  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-04  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-04  6:06 [openeuler:OLK-5.10 2610/2610] fs/fscache/cookie.c:239 fscache_hash_cookie() error: uninitialized symbol 'cursor' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-12-31 14:43 kernel test robot

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.