On Wed, Jul 31, 2024 at 06:46:39PM +0200, Christophe JAILLET wrote: > Le 31/07/2024 à 00:23, Kent Overstreet a écrit : > > On Tue, Jul 30, 2024 at 02:45:17PM GMT, Dan Carpenter wrote: > > > Hello Kent Overstreet, > > > > > > Commit ffcbec607613 ("bcachefs: Kill opts.buckets_nouse") from Apr 6, > > > 2024 (linux-next), leads to the following Smatch static checker > > > warning: > > > > > > fs/bcachefs/super.c:1202 bch2_dev_free() > > > warn: 'ca->buckets_nouse' double freed > > > > yup, that's a bug > > > > -- >8 -- > > Subject: [PATCH] bcachefs: Fix double free of ca->buckets_nouse > > > > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > > Fixes: ffcbec6076 ("bcachefs: Kill opts.buckets_nouse") > > Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> > > > > diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c > > index 0542953a7a..6d0ce3d734 100644 > > --- a/fs/bcachefs/super.c > > +++ b/fs/bcachefs/super.c > > @@ -1195,7 +1195,6 @@ static void bch2_dev_free(struct bch_dev *ca) > > if (ca->kobj.state_in_sysfs) > > kobject_del(&ca->kobj); > > - kfree(ca->buckets_nouse); > > Hi, > > unrelated, but apparently this should also have been kvfree(). > > Dan, do you already have a check for such cases where kvfree() or kfree() > are called when the other one should be used instead? > No. I don't. I've been meaning to write one... KTODO: write a smatch check for calling kfree instead of kvfree() I'll probably do it in the next week or two. The min/max changes are higher priority right now. :P #painful regards, dan carpenter