Received: from eggs.gnu.org ([2001:4830:134:3::10]:59066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyM1r-0006bP-Uc for qemu-devel@nongnu.org; Fri, 29 May 2015 11:17:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyM1r-0000Nt-5T for qemu-devel@nongnu.org; Fri, 29 May 2015 11:16:59 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyM1q-0000Nh-V5 for qemu-devel@nongnu.org; Fri, 29 May 2015 11:16:59 -0400 From: Peter Maydell Date: Fri, 29 May 2015 16:16:55 +0100 Message-Id: <1432912615-23107-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] hw/display/exynos4210_fimd: Fix bit-swapping code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mitsyanko , Maksim Kozlov , Dmitry Solodkiy , Evgeny Voevodin , patches@linaro.org fimd_swap_data() includes code to reverse the bits in a 64-bit integer, but an off-by-one error meant that it would try to shift off the top of the integer. Correct the bug (spotted by Coverity). Signed-off-by: Peter Maydell --- Compile-tested only, I have no exynos images to test with. hw/display/exynos4210_fimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index 45c62af..3e59ee4 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -337,7 +337,7 @@ static inline void fimd_swap_data(unsigned int swap_ctl, uint64_t *data) if (swap_ctl & FIMD_WINCON_SWAP_BITS) { res = 0; for (i = 0; i < 64; i++) { - if (x & (1ULL << (64 - i))) { + if (x & (1ULL << (63 - i))) { res |= (1ULL << i); } } -- 1.9.1