kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: kernel-janitors@vger.kernel.org
Subject: Re: [Kernel-janitors] [PATCH] drivers/video/fbcmap.c kmalloc audit
Date: Tue, 27 Jan 2004 21:53:47 +0000	[thread overview]
Message-ID: <20040127220247.GA3586@conectiva.com.br> (raw)
In-Reply-To: <1075239420.3744.18.camel@ibm-d.pdx.osdl.net>

Em Tue, Jan 27, 2004 at 01:37:01PM -0800, Leann Ogasawara escreveu:
> Hi All,
> 
> Patch to audit kmalloc()'s and handle errors accordingly.  Thanks,
> 
> Leann
> 
> diffed against 2.6.2-rc2
> 
> === drivers/video/fbcmap.c 1.9 vs edited ==> --- 1.9/drivers/video/fbcmap.c	Mon Mar 31 13:51:12 2003
> +++ edited/drivers/video/fbcmap.c	Mon Jan 26 17:38:53 2004
> @@ -98,14 +98,14 @@
>  	if (!len)
>  	    return 0;
>  	if (!(cmap->red = kmalloc(size, GFP_ATOMIC)))
> -	    return -1;
> +	    goto err_red;
>  	if (!(cmap->green = kmalloc(size, GFP_ATOMIC)))
> -	    return -1;
> +	    goto err_green;
>  	if (!(cmap->blue = kmalloc(size, GFP_ATOMIC)))
> -	    return -1;
> +	    goto err_blue;
>  	if (transp) {
>  	    if (!(cmap->transp = kmalloc(size, GFP_ATOMIC)))
> -		return -1;
> +		goto err_transp;
>  	} else
>  	    cmap->transp = NULL;
>      }
> @@ -113,6 +113,17 @@
>      cmap->len = len;
>      fb_copy_cmap(fb_default_cmap(len), cmap, 0);
>      return 0;
> +
> + err_transp:
> +    kfree(cmap->blue);
> + err_blue:
> +    kfree(cmap->green);
> + err_green:
> +    kfree(cmap->red);
> + err_red:
> +    cmap->red = cmap->green = cmap->blue = cmap->transp = NULL;
> +    cmap->len = 0;
> +    return -1;

Looks good to me.

- Arnaldo
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2004-01-27 21:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-27 21:37 [Kernel-janitors] [PATCH] drivers/video/fbcmap.c kmalloc audit Leann Ogasawara
2004-01-27 21:44 ` [Kernel-janitors] [PATCH] drivers/video/vga16fb.c ioremap() and Leann Ogasawara
2004-01-27 21:53 ` Arnaldo Carvalho de Melo [this message]
2004-01-27 21:54 ` [Kernel-janitors] [PATCH] drivers/video/fbcmap.c kmalloc audit Daniele Bellucci
2004-01-27 22:05 ` Randy.Dunlap
2004-01-27 22:17 ` Daniele Bellucci
2004-02-06 22:31 ` [Kernel-janitors] [PATCH] drivers/video/radeonfb.c fb_alloc_cmap() Leann Ogasawara
2004-02-06 22:36 ` [Kernel-janitors] [PATCH] drivers/video/cyber2000fb.c Leann Ogasawara
2004-02-06 22:38 ` [Kernel-janitors] [PATCH] drivers/video/vfb.c fb_alloc_cmap() audit Leann Ogasawara
2004-02-06 22:39 ` [Kernel-janitors] [PATCH] drivers/video/vesafb.c fb_alloc_cmap() Leann Ogasawara
2004-02-06 22:41 ` [Kernel-janitors] [PATCH] drivers/video/neofb.c fb_alloc_cmap() Leann Ogasawara
2004-02-06 23:23 ` [Kernel-janitors] [PATCH] drivers/video/radeonfb.c Domen Puncer
2004-02-07 15:37 ` [Kernel-janitors] [PATCH] drivers/video/pm2fb.c MIN/MAX removal Michael Veeck
2004-02-18 22:13 ` [Kernel-janitors] [PATCH] drivers/video/neofb.patch update Leann Ogasawara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040127220247.GA3586@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).