From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] staging: bcm2835-audio: allocate enough data for work queues
Date: Tue, 14 Feb 2017 23:15:44 +0000 [thread overview]
Message-ID: <20170214231544.GA9284@mwanda> (raw)
We accidentally allocate sizeof(void *) bytes instead of 112 bytes. It
results in memory corruption.
Fixes: 23b028c871e1 ("staging: bcm2835-audio: initial staging submission")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
index d11f2cdd1014..f5c6a83569f3 100644
--- a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
@@ -134,8 +134,9 @@ int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream)
int ret = -1;
LOG_DBG(" .. IN\n");
if (alsa_stream->my_wq) {
- struct bcm2835_audio_work *work - kmalloc(sizeof(struct bcm2835_audio_work *), GFP_ATOMIC);
+ struct bcm2835_audio_work *work;
+
+ work = kmalloc(sizeof(*work), GFP_ATOMIC);
/*--- Queue some work (item 1) ---*/
if (work) {
INIT_WORK(&work->my_work, my_wq_function);
@@ -155,8 +156,9 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream)
int ret = -1;
LOG_DBG(" .. IN\n");
if (alsa_stream->my_wq) {
- struct bcm2835_audio_work *work - kmalloc(sizeof(struct bcm2835_audio_work *), GFP_ATOMIC);
+ struct bcm2835_audio_work *work;
+
+ work = kmalloc(sizeof(*work), GFP_ATOMIC);
/*--- Queue some work (item 1) ---*/
if (work) {
INIT_WORK(&work->my_work, my_wq_function);
@@ -177,8 +179,9 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
int ret = -1;
LOG_DBG(" .. IN\n");
if (alsa_stream->my_wq) {
- struct bcm2835_audio_work *work - kmalloc(sizeof(struct bcm2835_audio_work *), GFP_ATOMIC);
+ struct bcm2835_audio_work *work;
+
+ work = kmalloc(sizeof(*work), GFP_ATOMIC);
/*--- Queue some work (item 1) ---*/
if (work) {
INIT_WORK(&work->my_work, my_wq_function);
reply other threads:[~2017-02-14 23:15 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=20170214231544.GA9284@mwanda \
--to=dan.carpenter@oracle.com \
--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