From: Maxime Bizon Date: Mon, 22 Oct 2012 09:19:28 +0000 (+0200) Subject: pstore/ram: Fix undefined usage of rounddown_pow_of_two(0) X-Git-Tag: omap-for-v3.8/fixes-for-merge-window-v4-signed~4^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b042e47491ba5f487601b5141a3f1d8582304170;p=pandora-kernel.git pstore/ram: Fix undefined usage of rounddown_pow_of_two(0) record_size / console_size / ftrace_size can be 0 (this is how you disable the feature), but rounddown_pow_of_two(0) is undefined. As suggested by Kees Cook, use !is_power_of_2() as a condition to call rounddown_pow_of_two and avoid its undefined behavior on the value 0. This issue has been present since commit 1894a253 (ramoops: Move to fs/pstore/ram.c). Cc: stable@vger.kernel.org Signed-off-by: Maxime Bizon Signed-off-by: Florian Fainelli Acked-by: Kees Cook Signed-off-by: Anton Vorontsov --- Reading git-diff-tree failed