diff mbox

hw/display/exynos4210_fimd: Fix bit-swapping code

Message ID 1432912615-23107-1-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show

Commit Message

Peter Maydell May 29, 2015, 3:16 p.m. UTC
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 <peter.maydell@linaro.org>
---
Compile-tested only, I have no exynos images to test with.

 hw/display/exynos4210_fimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell May 29, 2015, 3:19 p.m. UTC | #1
On 29 May 2015 at 16:16, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
> ---
> Compile-tested only, I have no exynos images to test with.

I see that all three samsung.com addresses in MAINTAINERS for
the exynos board bounce :-(

-- PMM
Peter Maydell June 5, 2015, 3:05 p.m. UTC | #2
Ping for either patch review or suggestions
for updating the MAINTAINERS section for this board?

thanks
-- PMM

On 29 May 2015 at 16:16, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
> ---
> 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
>
>
Peter Maydell June 12, 2015, 2:08 p.m. UTC | #3
Deafening silence, so I'm just going to apply this to target-arm.next.

-- PMM

On 5 June 2015 at 16:05, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping for either patch review or suggestions
> for updating the MAINTAINERS section for this board?
>
> thanks
> -- PMM
>
> On 29 May 2015 at 16:16, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 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 <peter.maydell@linaro.org>
>> ---
>> 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
diff mbox

Patch

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);
             }
         }