All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] buggered kmalloc()
@ 2007-07-20 15:03 Al Viro
  2007-07-20 20:05 ` Dave Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2007-07-20 15:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Mike Christie, linux-kernel, linux-scsi

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index aebcd5f..7829ab1 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -1885,7 +1885,7 @@ static int iscsi_tcp_get_addr(struct iscsi_conn *conn, struct socket *sock,
 	struct sockaddr_in *sin;
 	int rc = 0, len;
 
-	addr = kmalloc(GFP_KERNEL, sizeof(*addr));
+	addr = kmalloc(sizeof(*addr), GFP_KERNEL);
 	if (!addr)
 		return -ENOMEM;
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] buggered kmalloc()
  2007-07-20 15:03 [PATCH] buggered kmalloc() Al Viro
@ 2007-07-20 20:05 ` Dave Jones
  2007-07-20 21:00   ` Al Viro
  2007-07-20 21:34   ` Arjan van de Ven
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Jones @ 2007-07-20 20:05 UTC (permalink / raw)
  To: Al Viro
  Cc: Linus Torvalds, Mike Christie, linux-kernel, linux-scsi,
	Andy Whitcroft

On Fri, Jul 20, 2007 at 04:03:40PM +0100, Al Viro wrote:
 > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
 > ---
 > diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
 > index aebcd5f..7829ab1 100644
 > --- a/drivers/scsi/iscsi_tcp.c
 > +++ b/drivers/scsi/iscsi_tcp.c
 > @@ -1885,7 +1885,7 @@ static int iscsi_tcp_get_addr(struct iscsi_conn *conn, struct socket *sock,
 >  	struct sockaddr_in *sin;
 >  	int rc = 0, len;
 >  
 > -	addr = kmalloc(GFP_KERNEL, sizeof(*addr));
 > +	addr = kmalloc(sizeof(*addr), GFP_KERNEL);
 >  	if (!addr)
 >  		return -ENOMEM;

This seems like something that would be trivial to check for in checkpatch.

	Dave

-- 
http://www.codemonkey.org.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] buggered kmalloc()
  2007-07-20 20:05 ` Dave Jones
@ 2007-07-20 21:00   ` Al Viro
  2007-07-20 21:34   ` Arjan van de Ven
  1 sibling, 0 replies; 4+ messages in thread
From: Al Viro @ 2007-07-20 21:00 UTC (permalink / raw)
  To: Dave Jones, Linus Torvalds, Mike Christie, linux-kernel,
	linux-scsi, Andy Whitcroft

On Fri, Jul 20, 2007 at 04:05:30PM -0400, Dave Jones wrote:
> On Fri, Jul 20, 2007 at 04:03:40PM +0100, Al Viro wrote:
>  > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>  > ---
>  > diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
>  > index aebcd5f..7829ab1 100644
>  > --- a/drivers/scsi/iscsi_tcp.c
>  > +++ b/drivers/scsi/iscsi_tcp.c
>  > @@ -1885,7 +1885,7 @@ static int iscsi_tcp_get_addr(struct iscsi_conn *conn, struct socket *sock,
>  >  	struct sockaddr_in *sin;
>  >  	int rc = 0, len;
>  >  
>  > -	addr = kmalloc(GFP_KERNEL, sizeof(*addr));
>  > +	addr = kmalloc(sizeof(*addr), GFP_KERNEL);
>  >  	if (!addr)
>  >  		return -ENOMEM;
> 
> This seems like something that would be trivial to check for in checkpatch.

Or just run sparse before and after - all such places stand out immediately...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] buggered kmalloc()
  2007-07-20 20:05 ` Dave Jones
  2007-07-20 21:00   ` Al Viro
@ 2007-07-20 21:34   ` Arjan van de Ven
  1 sibling, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2007-07-20 21:34 UTC (permalink / raw)
  To: Dave Jones
  Cc: Al Viro, Linus Torvalds, Mike Christie, linux-kernel, linux-scsi,
	Andy Whitcroft

On Fri, 2007-07-20 at 16:05 -0400, Dave Jones wrote:
> On Fri, Jul 20, 2007 at 04:03:40PM +0100, Al Viro wrote:
>  > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>  > ---
>  > diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
>  > index aebcd5f..7829ab1 100644
>  > --- a/drivers/scsi/iscsi_tcp.c
>  > +++ b/drivers/scsi/iscsi_tcp.c
>  > @@ -1885,7 +1885,7 @@ static int iscsi_tcp_get_addr(struct iscsi_conn *conn, struct socket *sock,
>  >  	struct sockaddr_in *sin;
>  >  	int rc = 0, len;
>  >  
>  > -	addr = kmalloc(GFP_KERNEL, sizeof(*addr));
>  > +	addr = kmalloc(sizeof(*addr), GFP_KERNEL);
>  >  	if (!addr)
>  >  		return -ENOMEM;
> 
> This seems like something that would be trivial to check for in checkpatch.

and at runtime if we make a __GFP_VALID flag we add to all GFP_'s (and
is just a few high bits in a specific pattern) and check that inside
kmalloc.. since kmalloc is inline just about always it's a constant and
thus compiled out check.. 
-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-20 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20 15:03 [PATCH] buggered kmalloc() Al Viro
2007-07-20 20:05 ` Dave Jones
2007-07-20 21:00   ` Al Viro
2007-07-20 21:34   ` Arjan van de Ven

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.