smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: kent.overstreet@gmail.com, linux-bcachefs@vger.kernel.org,
	smatch@vger.kernel.org
Subject: Re: [bug report] bcachefs: missing error checks for bio_alloc_bioset()
Date: Tue, 20 Feb 2024 14:39:35 +0300	[thread overview]
Message-ID: <b1167150-77ee-414c-9858-50e8c90dbd6e@moroto.mountain> (raw)
In-Reply-To: <jno3abkiamnwk7nqh7ojvzvrurk2ua7q3fkhnhugsxdh5vjkbh@a43f35palmkn>

On Thu, Feb 01, 2024 at 05:45:38AM -0500, Kent Overstreet wrote:
> Smatch would be more useful to me if I could just run it myself, in my
> own CI, and get results back for new code when I get the rest of my test
> results, instead of getting yanked out of my flow a week later to go
> abck and look at code I thought I was done with.

Programming Smatch is quite difficult but running Smatch is fairly easy.
It's documented in Documentation/smatch.txt.

To test the kernel it's just:
~/path/to/smatch/smatch_scripts/test_kernel.sh

Or to just test the parts you are interested in the it's:
~/path/to/smatch/smatch_scripts/kchecker fs/bcachefs/

To build the database takes maybe six hours but it's also easy enough.
~/path/to/smatch/smatch_scripts/build_kernel_data.sh

The main issue is that I'm always writting new code.  And sometimes that
code is bad.  Or sometimes I'm using a heuristic to find buggy code and
it works but not well enough to publish.  For example code like:

	if (!ret)
		return ret;

I would estimate that in new code that's going to be buggy 5-10% of the
time.  (Obviously after we fix the bugs it's 100% false positives).  I
review code like this but I try to avoid publishing checks where there
is a more than 50% false positive rate.

So right now I only have two bcache warnings.  The missing error code
warning isn't published unfortunately...  I don't think I'm going to
have a lot of time to dedicate to this stuff in the up coming months
honestly.

fs/bcachefs/journal.c:575 __journal_res_get() error: uninitialized symbol 'can_discard'.
fs/bcachefs/alloc_background.c:1751 bch2_discard_one_bucket() warn: missing error code here? 'discard_in_flight_add()' failed. 'ret' = '0'

regards,
dan carpenter

       reply	other threads:[~2024-02-20 11:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0c35596b-a280-40df-946c-c50574c3ce26@moroto.mountain>
     [not found] ` <fufpv24643xxn3a5jpfxx4wbfwlczrhjyzqkxo33be3yeb4sea@y4obfahio6ag>
     [not found]   ` <11e692bc-4077-4e82-b680-fa86182d15d9@moroto.mountain>
     [not found]     ` <34p5j77iamkybfexdpjslxegy74da7mjtpsssrv4mems4bo5mj@5xlpdnvm4yxz>
     [not found]       ` <e92fc993-ab94-4f3b-9ee2-4e0ca5341720@moroto.mountain>
     [not found]         ` <uxyjkjzbur2unpdkt5yl2bojacg4tptfj6k4zyshcyvyfun3i7@y6q267iebdgg>
     [not found]           ` <a1d5fc7c-87ac-45f5-8f3d-5af1b7cd3614@moroto.mountain>
     [not found]             ` <jno3abkiamnwk7nqh7ojvzvrurk2ua7q3fkhnhugsxdh5vjkbh@a43f35palmkn>
2024-02-20 11:39               ` Dan Carpenter [this message]
2024-02-20 21:26                 ` [bug report] bcachefs: missing error checks for bio_alloc_bioset() Kent Overstreet
2024-02-21  6:01                   ` Dan Carpenter
2024-02-22  0:02                     ` Kent Overstreet

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=b1167150-77ee-414c-9858-50e8c90dbd6e@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=kent.overstreet@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=smatch@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).