public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [bug report] bio: add allocation cache abstraction
Date: Fri, 6 Feb 2026 16:41:32 +0300	[thread overview]
Message-ID: <aYXvjAi0L-4casuv@stanley.mountain> (raw)
In-Reply-To: <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>

[ 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

           reply	other threads:[~2026-02-06 13:41 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>]

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=aYXvjAi0L-4casuv@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox