drivers/net/sunhme.c, unbalanced and unchecked ioremap()
PATCH 1/1 drivers/net/sunhme.c, unbalanced and unchecked ioremap()
Hi all,
I found that sunhme.c doesn't check ioremap() return value and doesn't call iounmap() on module unload. Attached patch (for 2.4.1-ac20) should fix it, compiles clearly, but untested (I have no such hardware).
Best regards.
Signature · 2 lines
Andrey Panin | Embedded systems software engineer [email protected] | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
drivers/net/sunhme.c +5 -1
@@ -2856,7 +2856,10 @@printk (KERN_ERR "happymeal(PCI): Cannot find proper PCI device base address.\n" );return -ENODEV ; } - hpreg_base = (unsigned long )ioremap (hpreg_base,0x8000 ); +if ((hpreg_base = (unsigned long )ioremap (hpreg_base,0x8000 )) ==0 ) { +printk (KERN_ERR "happymeal(PCI): Unable to remap card memory.\n" ); +return -ENODEV ; + }for (i =0 ; i <6 ; i++) {if (macaddr[i] !=0 )
@@ -3071,6 +3074,7 @@PAGE_SIZE , hp->happy_block, hp->hblock_dvma); + iounmap((void *)hp->gregs); }#endif unregister_netdev (hp->dev);
Quoted 3 lines · Andrey Panin
I found that
sunhme.cdoesn't checkioremap()return value and doesn't calliounmap()on module unload. Attached patch (for 2.4.1-ac20) should fix it, compiles clearly, but untested (I have no such hardware).
Thanks I've applied this patch.
Later,
David S. Miller
[email protected]