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] [day] [month] [year] [list]
Message-ID: <20130513060842.GA2947@katana>
Date:	Mon, 13 May 2013 08:08:46 +0200
From:	Wolfram Sang <wsa@...-dreams.de>
To:	Vinod Koul <vinod.koul@...el.com>
Cc:	Stephen Warren <swarren@...dotorg.org>,
	linux-kernel@...r.kernel.org, Dan Williams <djbw@...com>,
	linux-tegra@...r.kernel.org
Subject: Re: [RFC 04/42] drivers/dma: don't check resource with
 devm_ioremap_resource


> > > > >>> devm_ioremap_resource does sanity checks on the given resource. No need to
> > > > >>> duplicate this in the driver.
> > > > >>
> > > > >>> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> > > > >>
> > > > >>>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > > >>> -	if (!res) {
> > > > >>> -		dev_err(&pdev->dev, "No mem resource for DMA\n");
> > > > >>> -		return -EINVAL;
> > > > >>> -	}
> > > > >>> -
> > > > >>>  	tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
> > > > >>
> > > > >> One issue here is that it's not obvious just from reading the code
> > > > >> that's left behind that the "missing" error-checking of the
> > > > >> platform_get_resource() return value is OK because
> > > > >> devm_ioremap_resource() will check it "for us". Everyone now has to
> > > > >> mentally maintain a list of exceptions where it's OK not to error-check.
> > > > > 
> > > > > My goal is to make not-checking the standard case with devm.
> > > > 
> > > > OK, if no parameters passed to any devm function every need to be
> > > > error-checked, that'll certainly be a bit easier to remember.
> > > Okay to remove the log message and move to devm_ but I dont agree with this
> > > patch not returning error above. We shouldnt supress the error..
> > 
> > The error will be reported because devm_ioremap_resource will return an
> > ERR_PTR.
> And this patch removed the check on 'res' pointer, so on failure we continue...

I don't get it. What is the difference between a manual check of res and
the directly following devm_ioremap_resource returning ERR_PTR(-EINVAL)
if res is NULL?

--
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