regmap: Fix possible ZERO_SIZE_PTR pointer dereferencing error.
authorXiubo Li <Li.Xiubo@freescale.com>
Wed, 30 Apr 2014 09:31:08 +0000 (17:31 +0800)
committerMark Brown <broonie@linaro.org>
Thu, 1 May 2014 03:33:57 +0000 (20:33 -0700)
Since we cannot make sure the 'len = pair_size * num_regs' will always
be none zero from the users, and then if 'num_regs' equals to zero by
mistake or other reasons, the kzalloc() will return ZERO_SIZE_PTR, which
equals to ((void *)16).

So this patch fix this with just doing the 'len' zero check before calling
kzalloc().

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

No differences found