From: Xiubo Li <Li.Xiubo@freescale.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH] ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error.
Date: Sun, 28 Sep 2014 17:29:37 +0800 [thread overview]
Message-ID: <1411896577-30965-1-git-send-email-Li.Xiubo@freescale.com> (raw)
Since we cannot make sure the 'params->num_regs' will always be none
zero here, and then if it equals to zero, the kmemdup() will return
ZERO_SIZE_PTR, which equals to ((void *)16).
So this patch fix this with just doing the zero check before calling
kmemdup().
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
sound/soc/soc-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7b5a7ce..263514a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3051,7 +3051,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
unsigned int val, mask;
void *data;
- if (!component->regmap)
+ if (!component->regmap || !params->num_regs)
return -EINVAL;
len = params->num_regs * component->val_bytes;
--
2.1.0.27.g96db324
next reply other threads:[~2014-09-28 9:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-28 9:29 Xiubo Li [this message]
2014-09-28 10:50 ` [PATCH] ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error Mark Brown
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=1411896577-30965-1-git-send-email-Li.Xiubo@freescale.com \
--to=li.xiubo@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@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.