qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 40fe17: hw/ide/ahci.c: Fix shift left into si


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 40fe17: hw/ide/ahci.c: Fix shift left into sign bit
Date: Sun, 18 Oct 2015 07:30:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 40fe17bea478793fc9106a630fa3610dad51f939
      
https://github.com/qemu/qemu/commit/40fe17bea478793fc9106a630fa3610dad51f939
  Author: Peter Maydell <address@hidden>
  Date:   2015-10-18 (Sun, 18 Oct 2015)

  Changed paths:
    M hw/ide/ahci.c

  Log Message:
  -----------
  hw/ide/ahci.c: Fix shift left into sign bit

Avoid undefined behaviour from shifting left into the sign bit:

hw/ide/ahci.c:551:36: runtime error: left shift of 255 by 24 places cannot be 
represented in type 'int'

(Unfortunately C's promotion rules mean that in the expression
"some_uint8_t_variable << 24" the LHS gets promoted to signed
int before shifting.)

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: John Snow <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]