ASoC: cache: Do the codec->reg_cache zero pionter check
authorXiubo Li <Li.Xiubo@freescale.com>
Fri, 28 Feb 2014 02:48:19 +0000 (10:48 +0800)
committerMark Brown <broonie@linaro.org>
Tue, 4 Mar 2014 04:32:19 +0000 (12:32 +0800)
For the snd_soc_cache_init(), the reg_size maybe zero and then the value
of codec->reg_cache, which is alloced via kzalloc, maybe equal to
ZERO_SIZE_PTR. If the reg parameter of snd_soc_cache_write() is large enough,
the cache[idx] = val maybe cause the kernel crash...

So this patch fix this via doing the zero pionter check of it.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-cache.c

Simple merge