On 11/5/26 05:15, Philippe Mathieu-Daudé wrote:
icount_configure() rejects "shift=auto" combined with "align=on"
or "sleep=off", but the checks read the file-scope variables
icount_align_option and icount_sleep. Those are only assigned
from the parsed options after the checks, so at that point they
still hold their defaults (false and true). Neither check can
trigger, and both invalid combinations were silently accepted:

   $ qemu-system-aarch64 -M virt -icount shift=auto,sleep=off
   $ qemu-system-aarch64 -M virt -icount shift=auto,align=on

Test the values just parsed from the command line instead.
Both commands now fail with:

   qemu-system-aarch64: -icount shift=auto,sleep=off: shift=auto and sleep=off 
are incompatible
   qemu-system-aarch64: -icount shift=auto,align=on: shift=auto and align=on 
are incompatible

Valid combinations still accepted:

  - shift=auto
  - shift=3,sleep=off
  - shift=3,align=on

Fixes: abc9bf69a66a ("cpus: Fix configure_icount() error API violation")
Signed-off-by: Philippe Mathieu-Daudé<[email protected]>
---
  accel/tcg/icount-common.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <[email protected]>

r~

Reply via email to