public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/pcmcia/cs.c
@ 2001-01-10 18:23 Thiago Rondon
  2001-01-11  4:05 ` David Hinds
  0 siblings, 1 reply; 2+ messages in thread
From: Thiago Rondon @ 2001-01-10 18:23 UTC (permalink / raw)
  To: dahinds; +Cc: Linux Kernel, Alan Cox


Check kmalloc().

-Thiago Rondon

--- linux-2.4.0-ac5/drivers/pcmcia/cs.c	Fri Dec 29 20:35:47 2000
+++ linux-2.4.0-ac5.maluco/drivers/pcmcia/cs.c	Wed Jan 10 16:18:11 2001
@@ -1458,6 +1458,8 @@
 	    s->functions = 1;
 	s->config = kmalloc(sizeof(config_t) * s->functions,
 			    GFP_KERNEL);
+	if (!s->config) 
+		return CS_OUT_OF_RESOURCE;
 	memset(s->config, 0, sizeof(config_t) * s->functions);
     }
     


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: [PATCH] drivers/pcmcia/cs.c
  2001-01-10 18:23 [PATCH] drivers/pcmcia/cs.c Thiago Rondon
@ 2001-01-11  4:05 ` David Hinds
  0 siblings, 0 replies; 2+ messages in thread
From: David Hinds @ 2001-01-11  4:05 UTC (permalink / raw)
  To: Thiago Rondon, dahinds; +Cc: Linux Kernel, Alan Cox

On Wed, Jan 10, 2001 at 04:23:14PM -0200, Thiago Rondon wrote:
> 
> Check kmalloc().
> 
> -Thiago Rondon
> 
> --- linux-2.4.0-ac5/drivers/pcmcia/cs.c	Fri Dec 29 20:35:47 2000
> +++ linux-2.4.0-ac5.maluco/drivers/pcmcia/cs.c	Wed Jan 10 16:18:11 2001
> @@ -1458,6 +1458,8 @@
>  	    s->functions = 1;
>  	s->config = kmalloc(sizeof(config_t) * s->functions,
>  			    GFP_KERNEL);
> +	if (!s->config) 
> +		return CS_OUT_OF_RESOURCE;
>  	memset(s->config, 0, sizeof(config_t) * s->functions);
>      }

This is not a satisfactory fix; if that kmalloc ever fails, you also
need to back out various things that were done higher up.  You can't
bail out at this spot.

-- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2001-01-11  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-10 18:23 [PATCH] drivers/pcmcia/cs.c Thiago Rondon
2001-01-11  4:05 ` David Hinds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox