* [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on memory allocation failure
@ 2010-10-15 12:55 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-10-15 12:54 UTC (permalink / raw)
To: Pat Gefre; +Cc: kernel-janitors, linux-ia64, linux-mips, linux-kernel
From: Julia Lawall <julia@diku.dk>
In this code, 0 is returned on memory allocation failure, even though other
failures return -ENOMEM or other similar values.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression ret;
expression x,e1,e2,e3;
@@
ret = 0
... when != ret = e1
*x = \(kmalloc\|kcalloc\|kzalloc\)(...)
... when != ret = e2
if (x = NULL) { ... when != ret = e3
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/serial/ioc3_serial.c | 1 +
1 file changed, 1 insertion(+)
diff -u -p a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2045,6 +2045,7 @@ ioc3uart_probe(struct ioc3_submodule *is
if (!port) {
printk(KERN_WARNING
"IOC3 serial memory not available for port\n");
+ ret = -ENOMEM;
goto out4;
}
spin_lock_init(&port->ip_lock);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on memory allocation failure
@ 2010-10-15 12:55 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-10-15 12:55 UTC (permalink / raw)
To: Pat Gefre; +Cc: kernel-janitors, linux-ia64, linux-mips, linux-kernel
From: Julia Lawall <julia@diku.dk>
In this code, 0 is returned on memory allocation failure, even though other
failures return -ENOMEM or other similar values.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression ret;
expression x,e1,e2,e3;
@@
ret = 0
... when != ret = e1
*x = \(kmalloc\|kcalloc\|kzalloc\)(...)
... when != ret = e2
if (x = NULL) { ... when != ret = e3
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/serial/ioc3_serial.c | 1 +
1 file changed, 1 insertion(+)
diff -u -p a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2045,6 +2045,7 @@ ioc3uart_probe(struct ioc3_submodule *is
if (!port) {
printk(KERN_WARNING
"IOC3 serial memory not available for port\n");
+ ret = -ENOMEM;
goto out4;
}
spin_lock_init(&port->ip_lock);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on memory allocation failure
@ 2010-10-15 12:55 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-10-15 13:00 UTC (permalink / raw)
To: Pat Gefre; +Cc: kernel-janitors, linux-ia64, linux-mips, linux-kernel
From: Julia Lawall <julia@diku.dk>
In this code, 0 is returned on memory allocation failure, even though other
failures return -ENOMEM or other similar values.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression ret;
expression x,e1,e2,e3;
@@
ret = 0
... when != ret = e1
*x = \(kmalloc\|kcalloc\|kzalloc\)(...)
... when != ret = e2
if (x == NULL) { ... when != ret = e3
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/serial/ioc3_serial.c | 1 +
1 file changed, 1 insertion(+)
diff -u -p a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2045,6 +2045,7 @@ ioc3uart_probe(struct ioc3_submodule *is
if (!port) {
printk(KERN_WARNING
"IOC3 serial memory not available for port\n");
+ ret = -ENOMEM;
goto out4;
}
spin_lock_init(&port->ip_lock);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on
2010-10-15 12:55 ` Julia Lawall
@ 2010-10-15 14:08 ` Ralf Baechle
-1 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2010-10-15 14:08 UTC (permalink / raw)
To: Julia Lawall
Cc: Pat Gefre, kernel-janitors, linux-ia64, linux-mips, linux-kernel
On Fri, Oct 15, 2010 at 03:00:09PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> In this code, 0 is returned on memory allocation failure, even though other
> failures return -ENOMEM or other similar values.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
Dunno why linux-mips rsp. myself keep receiving patches for the ioc3 serial
driver - it's only being used on SGI IA64 machines.
Either way, I'm willing to funnel this patch upstream - I'm building a
pull rq for tonight anyway.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on memory allocation failure
@ 2010-10-15 14:08 ` Ralf Baechle
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2010-10-15 14:08 UTC (permalink / raw)
To: Julia Lawall
Cc: Pat Gefre, kernel-janitors, linux-ia64, linux-mips, linux-kernel
On Fri, Oct 15, 2010 at 03:00:09PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> In this code, 0 is returned on memory allocation failure, even though other
> failures return -ENOMEM or other similar values.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
Dunno why linux-mips rsp. myself keep receiving patches for the ioc3 serial
driver - it's only being used on SGI IA64 machines.
Either way, I'm willing to funnel this patch upstream - I'm building a
pull rq for tonight anyway.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-15 14:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-15 12:54 [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on memory allocation failure Julia Lawall
2010-10-15 13:00 ` Julia Lawall
2010-10-15 12:55 ` Julia Lawall
2010-10-15 14:08 ` [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on Ralf Baechle
2010-10-15 14:08 ` [PATCH 6/7] drivers/serial/ioc3_serial.c: Return -ENOMEM on memory allocation failure Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.