From: Xiubo Li Date: Thu, 9 Oct 2014 09:02:57 +0000 (+0800) Subject: regmap: cache: Fix possible ZERO_SIZE_PTR pointer dereferencing error. X-Git-Tag: omap-for-v3.19/fixes-for-merge-window~24^2~1^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb70067e4a2cc45d273864f071fd6cf62143137a;p=pandora-kernel.git regmap: cache: Fix possible ZERO_SIZE_PTR pointer dereferencing error. When all the registers are volatile(unlikely, but logically and mostly will happen for some 'device' who has very few registers), then the count will be euqal to 0, then kmalloc() will return ZERO_SIZE_PTR, which equals to ((void *)16). So this patch fix this with just doing the zero check before calling kmalloc(). If the count == 0, so we can make sure that all the registers are volatile, so no cache is need. Signed-off-by: Xiubo Li Signed-off-by: Mark Brown --- Reading git-diff-tree failed