[mtd-next:master 11/11] drivers/mtd/mtdcore.c:1786:29-32: ERROR: reference preceded by free on line 1784 (fwd)
Brian Norris
computersforpeace at gmail.com
Thu Dec 1 13:52:06 PST 2016
On Thu, Dec 01, 2016 at 09:00:27PM +0100, Julia Lawall wrote:
> It's a false positive from Coccinelle, but I wonder if it's really worth
> it. Perhaps the code would be simpler with if (ret) { kfree(bdi); return
> ERR_PTR(ret); } return bdi;
I ran your coccinelle scripts before merging, noticed the false
positive, and decided to ignore. But feel free to send the above patch
-- it's probably clearer anyway.
Thanks,
Brian
> julia
>
>
>
> tree: git://git.infradead.org/linux-mtd-next.git master
> head: 445caaa20c4d6da74f426464f90513b81157ad77
> commit: 445caaa20c4d6da74f426464f90513b81157ad77 [11/11] mtd: Allocate bdi objects dynamically
> :::::: branch date: 2 hours ago
> :::::: commit date: 2 hours ago
>
> >> drivers/mtd/mtdcore.c:1786:29-32: ERROR: reference preceded by free on line 1784
>
> git remote add mtd-next git://git.infradead.org/linux-mtd-next.git
> git remote update mtd-next
> git checkout 445caaa20c4d6da74f426464f90513b81157ad77
> vim +1786 drivers/mtd/mtdcore.c
>
> 445caaa2 Steve Longerbeam 2016-08-04 1778 bdi = kzalloc(sizeof(*bdi), GFP_KERNEL);
> 445caaa2 Steve Longerbeam 2016-08-04 1779 if (!bdi)
> 445caaa2 Steve Longerbeam 2016-08-04 1780 return ERR_PTR(-ENOMEM);
> 0661b1ac Jens Axboe 2010-04-27 1781
> 445caaa2 Steve Longerbeam 2016-08-04 1782 ret = bdi_setup_and_register(bdi, name);
> 0661b1ac Jens Axboe 2010-04-27 1783 if (ret)
> 445caaa2 Steve Longerbeam 2016-08-04 @1784 kfree(bdi);
> 0661b1ac Jens Axboe 2010-04-27 1785
> 445caaa2 Steve Longerbeam 2016-08-04 @1786 return ret ? ERR_PTR(ret) : bdi;
> 694bb7fc Kevin Cernekee 2009-04-03 1787 }
> 0661b1ac Jens Axboe 2010-04-27 1788
> 93e56214 Artem Bityutskiy 2013-03-15 1789 static struct proc_dir_entry *proc_mtd;
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
More information about the linux-mtd
mailing list