]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Fix possible ZERO_SIZE_PTR pointer dereferencing error.
authorXiubo Li <Li.Xiubo@freescale.com>
Wed, 24 Sep 2014 06:30:29 +0000 (14:30 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 24 Sep 2014 08:52:43 +0000 (09:52 +0100)
commita9996a5f09f4f326e556787d894d70241476ad23
treeabecdcc00c0e480427e0c0d1a680ce31df268220
parentff0e68554325ad5d82e103e4bb9d0b858ed3ac19
spi: Fix possible ZERO_SIZE_PTR pointer dereferencing error.

Since we cannot make sure the 'n' will always be none zero here, and
then if either equal to zero, the kzalloc() will return ZERO_SIZE_PTR,
which equals to ((void *)16).

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

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c