lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1509231101050.23595@linuxheads99>
Date:	Wed, 23 Sep 2015 11:15:16 -0500
From:	atull <atull@...nsource.altera.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	Pavel Machek <pavel@...x.de>, Josh Cartwright <joshc@...com>,
	<mark.rutland@....com>, <linux-doc@...r.kernel.org>,
	<rubini@...dd.com>, <pantelis.antoniou@...sulko.com>,
	<hpa@...or.com>, <s.trumtrar@...gutronix.de>,
	<devel@...verdev.osuosl.org>, <sameo@...ux.intel.com>,
	<nico@...aro.org>, <ijc+devicetree@...lion.org.uk>,
	<michal.simek@...inx.com>, <kyle.teske@...com>,
	<jgunthorpe@...idianresearch.com>, <grant.likely@...aro.org>,
	<davidb@...eaurora.org>, <linus.walleij@...aro.org>,
	<cesarb@...arb.net>, <devicetree@...r.kernel.org>,
	<jason@...edaemon.net>, <pawel.moll@....com>,
	<iws@...o.caltech.edu>, <broonie@...nel.org>,
	<philip@...ister.org>, "Petr Cvek" <petr.cvek@....cz>,
	<dinguyen@...nsource.altera.com>, <monstr@...str.eu>,
	<gregkh@...uxfoundation.org>, <linux-kernel@...r.kernel.org>,
	<balbi@...com>, <delicious.quinoa@...il.com>, <robh+dt@...nel.org>,
	<rob@...dley.net>, <galak@...eaurora.org>,
	<akpm@...ux-foundation.org>, <davem@...emloft.net>,
	<m.chehab@...sung.com>
Subject: Re: [PATCH v11 3/4] add FPGA manager core

On Wed, 23 Sep 2015, Dan Carpenter wrote:

> On Wed, Sep 23, 2015 at 03:23:54PM +0200, Pavel Machek wrote:
> > > > +int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
> > > > +			   const char *image_name)
> > > > +{
> > > > +	struct device *dev = &mgr->dev;
> > > > +	const struct firmware *fw;
> > > > +	int ret;
> > > > +
> > > > +	if (!mgr)
> > > > +		return -ENODEV;
> > > 
> > > Again; I'm of the opinion this is needlessly defensive.
> > 
> > Not only that, it can never happen. mgr is already dereferenced above.
> > 
> 
> It's not dereferenced.  We're taking the address of mgr->dev but we
> don't dereference mgr.
> 
> regards,
> dan carpenter
> 
> 

That's correct, it's not dereferenced.

Is there some community agreement on whether we want to check a pointer
that has been passed for NULL or not?  This is C code after all.  Checking
a passed pointer for NULL is a very common reason to return -ENODEV.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ