public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] bio: add allocation cache abstraction
       [not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
@ 2026-02-06 13:41 ` Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-02-06 13:41 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel

[ Smatch checking is paused while we raise funding.  #SadFace
  https://lore.kernel.org/all/aTaiGSbWZ9DJaGo7@stanley.mountain/ -dan ]

Hello Jens Axboe,

Commit be4d234d7aeb ("bio: add allocation cache abstraction") from
Mar 8, 2021 (linux-next), leads to the following Smatch static
checker warning:

	block/bio.c:790 bio_cpu_dead()
	error: potential null dereference 'bs'.  (hlist_entry_safe() returns null)

block/bio.c
    785 static int bio_cpu_dead(unsigned int cpu, struct hlist_node *node)
    786 {
    787         struct bio_set *bs;
    788 
    789         bs = hlist_entry_safe(node, struct bio_set, cpuhp_dead);
--> 790         if (bs->cache) {

It doesn't really make sense to use hlist_entry_safe() instead of
hlist_entry() if we're not going to check for NULL.

    791                 struct bio_alloc_cache *cache = per_cpu_ptr(bs->cache, cpu);
    792 
    793                 bio_alloc_cache_prune(cache, -1U);
    794         }
    795         return 0;
    796 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-06 13:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
2026-02-06 13:41 ` [bug report] bio: add allocation cache abstraction Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox