From: Dave Jones <davej@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: linux-dvb@linuxtv.org, greg@kroah.com
Subject: Fix up 4KB stack allocation in DVB USB driver.
Date: Wed, 21 Jan 2004 19:38:35 +0000 [thread overview]
Message-ID: <20040121193835.GD9327@redhat.com> (raw)
Allocating 4KB on the stack can't be healthy.
Dave
diff -Nru a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c Wed Jan 21 19:10:44 2004
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c Wed Jan 21 19:10:44 2004
@@ -1145,7 +1145,7 @@
0x00, 0x00, 0x00, 0x00,
0x61, 0x00 };
u8 b1[] = { 0x61 };
- u8 b[ARM_PACKET_SIZE];
+ u8 *b;
char idstring[21];
u8 *firmware = NULL;
size_t firmware_size = 0;
@@ -1202,6 +1202,10 @@
trans_count = 0;
j = 0;
+ b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL);
+ if (b == NULL)
+ return -ENOMEM;
+
for (i = 0; i < firmware_size; i += COMMAND_PACKET_SIZE) {
size = firmware_size - i;
if (size > COMMAND_PACKET_SIZE)
@@ -1228,6 +1232,8 @@
}
result = ttusb_dec_send_command(dec, 0x43, sizeof(b1), b1, NULL, NULL);
+
+ kfree(b);
return result;
}
reply other threads:[~2004-01-21 19:40 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=20040121193835.GD9327@redhat.com \
--to=davej@redhat.com \
--cc=greg@kroah.com \
--cc=linux-dvb@linuxtv.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox