* [PATCH] drivers/char/serial.c unchecked ioremap() calls
@ 2001-02-23 7:53 Andrey Panin
2001-02-23 9:45 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Panin @ 2001-02-23 7:53 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 273 bytes --]
Hi all,
16x50 serial driver doesn't check ioremap() return value.
Atached patch should fix this it.
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
[-- Attachment #1.2: patch-ioremap-serial --]
[-- Type: text/plain, Size: 1103 bytes --]
diff -ur linux.vanilla/drivers/char/serial.c linux/drivers/char/serial.c
--- linux.vanilla/drivers/char/serial.c Thu Feb 22 20:50:18 2001
+++ linux/drivers/char/serial.c Thu Feb 22 23:01:48 2001
@@ -3876,7 +3876,8 @@
return 0;
}
req->io_type = SERIAL_IO_MEM;
- req->iomem_base = ioremap(port, board->uart_offset);
+ if ((req->iomem_base = ioremap(port, board->uart_offset)) == NULL)
+ return 1;
req->iomem_reg_shift = board->reg_shift;
req->port = 0;
return 0;
@@ -4010,7 +4011,8 @@
data | pci_config);
/* enable/disable interrupts */
- p = ioremap(pci_resource_start(dev, 0), 0x80);
+ if ((p = ioremap(pci_resource_start(dev, 0), 0x80)) == NULL)
+ return 1;
writel(enable ? irq_config : 0x00, (unsigned long)p + 0x4c);
iounmap(p);
@@ -4053,7 +4055,8 @@
if (!enable) return 0;
- p = ioremap(pci_resource_start(dev, 0), 0x80);
+ if ((p = ioremap(pci_resource_start(dev, 0), 0x80)) == NULL)
+ return 1;
switch (dev->device & 0xfff8) {
case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/char/serial.c unchecked ioremap() calls
2001-02-23 7:53 [PATCH] drivers/char/serial.c unchecked ioremap() calls Andrey Panin
@ 2001-02-23 9:45 ` Arnaldo Carvalho de Melo
2001-02-23 14:15 ` Jeff Garzik
0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-23 9:45 UTC (permalink / raw)
To: Andrey Panin; +Cc: linux-kernel
Em Fri, Feb 23, 2001 at 10:53:59AM +0300, Andrey Panin escreveu:
>
> Hi all,
>
> 16x50 serial driver doesn't check ioremap() return value.
> Atached patch should fix this it.
humm, have not checked, but it seems as if you don't release the previous
successful mappings on failure. Wipe out this message if I was too quick to
answer and this is not true. 8)
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/char/serial.c unchecked ioremap() calls
2001-02-23 9:45 ` Arnaldo Carvalho de Melo
@ 2001-02-23 14:15 ` Jeff Garzik
2001-02-26 15:06 ` Andrey Panin
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2001-02-23 14:15 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Andrey Panin, linux-kernel
Arnaldo Carvalho de Melo wrote:
>
> Em Fri, Feb 23, 2001 at 10:53:59AM +0300, Andrey Panin escreveu:
> >
> > Hi all,
> >
> > 16x50 serial driver doesn't check ioremap() return value.
> > Atached patch should fix this it.
>
> humm, have not checked, but it seems as if you don't release the previous
> successful mappings on failure. Wipe out this message if I was too quick to
> answer and this is not true. 8)
Also, the proper return from a failed ioremap is -ENOMEM, so I think
Andrey's serial.c patch should modify some functions to return a failure
code...
Jeff
--
Jeff Garzik | "You see, in this world there's two kinds of
Building 1024 | people, my friend: Those with loaded guns
MandrakeSoft | and those who dig. You dig." --Blondie
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/char/serial.c unchecked ioremap() calls
2001-02-23 14:15 ` Jeff Garzik
@ 2001-02-26 15:06 ` Andrey Panin
0 siblings, 0 replies; 4+ messages in thread
From: Andrey Panin @ 2001-02-26 15:06 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 988 bytes --]
On Fri, Feb 23, 2001 at 09:15:29AM -0500, Jeff Garzik wrote:
> Arnaldo Carvalho de Melo wrote:
> >
> > Em Fri, Feb 23, 2001 at 10:53:59AM +0300, Andrey Panin escreveu:
> > >
> > > Hi all,
> > >
> > > 16x50 serial driver doesn't check ioremap() return value.
> > > Atached patch should fix this it.
> >
> > humm, have not checked, but it seems as if you don't release the previous
> > successful mappings on failure. Wipe out this message if I was too quick to
> > answer and this is not true. 8)
>
> Also, the proper return from a failed ioremap is -ENOMEM, so I think
> Andrey's serial.c patch should modify some functions to return a failure
> code...
>
All these ioremap() failures are not fatal,
just fail to init one PCI/ISAPNP device or one serial port.
IMHO a warning message will be enough for them :)
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-02-26 15:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-23 7:53 [PATCH] drivers/char/serial.c unchecked ioremap() calls Andrey Panin
2001-02-23 9:45 ` Arnaldo Carvalho de Melo
2001-02-23 14:15 ` Jeff Garzik
2001-02-26 15:06 ` Andrey Panin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).