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
| ||
|
Date: Mon, 18 Dec 2017 21:03:08 +0100 From: Boris Brezillon <boris.brezillon@...e-electrons.com> To: Christophe JAILLET <christophe.jaillet@...adoo.fr> Cc: kyungmin.park@...sung.com, dwmw2@...radead.org, computersforpeace@...il.com, marek.vasut@...il.com, richard@....at, cyrille.pitchen@...ev4u.fr, linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org Subject: Re: [PATCH 1/4 v3] mtd: onenand: samsung: use devm_ function to simplify code and fix some leaks On Thu, 14 Dec 2017 07:03:49 +0100 Christophe JAILLET <christophe.jaillet@...adoo.fr> wrote: > Convert all error handling code in 's3c_onenand_probe()' to > resource-managed alternatives in order to simplify code. > > This fixes a resource leak if 'platform_get_resource()' fails at line 872. > > The 'request_irq()' at line 971 was also un-balanced. It is now > resource-managed. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr> > --- > Cross-compiled tested-only > > v2: use devm_ioremap_resource() > v3: fix a bug introduced in v2 > --- > drivers/mtd/onenand/samsung.c | 164 ++++++++---------------------------------- > 1 file changed, 29 insertions(+), 135 deletions(-) > > diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c > index af0ac1a7bf8f..b650290611d2 100644 > --- a/drivers/mtd/onenand/samsung.c > +++ b/drivers/mtd/onenand/samsung.c > @@ -129,16 +129,13 @@ struct s3c_onenand { > struct platform_device *pdev; > enum soc_type type; > void __iomem *base; > - struct resource *base_res; > void __iomem *ahb_addr; > - struct resource *ahb_res; > int bootram_command; > void __iomem *page_buf; > void __iomem *oob_buf; Next thing to address: page_buf and oob_buf are not iomem regions (they are allocated with kmalloc) and should not have an __iomem specifier. You should also get rid of the various casts transforming those iomem pointers into regular ones. > unsigned int (*mem_addr)(int fba, int fpa, int fsa); > unsigned int (*cmd_map)(unsigned int type, unsigned int val); > void __iomem *dma_addr; > - struct resource *dma_res; > unsigned long phys_base; > struct completion complete; > };
Powered by blists - more mailing lists