From: "Vladimir V. Klenov" <maple@ixcelerator.com>
To: linux-kernel@vger.kernel.org
Subject: missing check after kmalloc in drivers/video/sbus.c and not only
Date: Fri, 19 Jan 2001 19:59:41 +0300 [thread overview]
Message-ID: <20010119195941.A28566@ixcelerator.com> (raw)
Hello,
kernel is 2.4.1-pre8
missing check after kmalloc in drivers/video/sbus.c, possible memory leak
in case of sbusfb_init_fb() failure, unnesesary compare (memset to area
before).
best explanation is a patch, look:
--- drivers/video/sbusfb.c.orig Fri Jan 19 19:14:22 2001
+++ drivers/video/sbusfb.c Fri Jan 19 19:56:20 2001
@@ -1070,8 +1070,14 @@
fb->cursor.hwsize.fbx = 32;
fb->cursor.hwsize.fby = 32;
- if (depth > 1 && !fb->color_map)
+ if (depth > 1) {
fb->color_map = kmalloc(256 * 3, GFP_ATOMIC);
+ if(!fb->color_map) {
+ prom_printf("sbusfb: could not allocate memory for color map\n");
+ kfree(fb);
+ return;
+ }
+ }
switch(fbtype) {
#ifdef CONFIG_FB_CREATOR
@@ -1110,6 +1116,7 @@
}
if (!p) {
+ kfree(fb->color_map);
kfree(fb);
return;
}
@@ -1147,6 +1154,7 @@
sbusfb_set_var(var, -1, &fb->info);
if (register_framebuffer(&fb->info) < 0) {
+ kfree(fb->color_map);
kfree(fb);
return;
}
SY, Vladimir
-
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/
reply other threads:[~2001-01-19 17:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20010119195941.A28566@ixcelerator.com \
--to=maple@ixcelerator.com \
--cc=linux-kernel@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 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.