All of lore.kernel.org
 help / color / mirror / Atom feed
* [mtd-next:master 11/11] drivers/mtd/mtdcore.c:1786:29-32: ERROR: reference preceded by free on line 1784 (fwd)
@ 2016-12-01 20:00 Julia Lawall
  2016-12-01 21:52 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2016-12-01 20:00 UTC (permalink / raw)
  To: Steve Longerbeam
  Cc: Brian Norris, Jim Baxter, Sandeep Jain, Richard Weinberger,
	Marek Vasut, linux-mtd, kbuild-all

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;

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [mtd-next:master 11/11] drivers/mtd/mtdcore.c:1786:29-32: ERROR: reference preceded by free on line 1784 (fwd)
  2016-12-01 20:00 [mtd-next:master 11/11] drivers/mtd/mtdcore.c:1786:29-32: ERROR: reference preceded by free on line 1784 (fwd) Julia Lawall
@ 2016-12-01 21:52 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2016-12-01 21:52 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Steve Longerbeam, Jim Baxter, Sandeep Jain, Richard Weinberger,
	Marek Vasut, linux-mtd, kbuild-all

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-01 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 20:00 [mtd-next:master 11/11] drivers/mtd/mtdcore.c:1786:29-32: ERROR: reference preceded by free on line 1784 (fwd) Julia Lawall
2016-12-01 21:52 ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.