qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] target-sparc: fix 32-bit truncation in fpackfix


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH] target-sparc: fix 32-bit truncation in fpackfix, avoid undefined behavior
Date: Fri, 6 Nov 2015 17:10:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/06/2015 04:50 PM, Paolo Bonzini wrote:
This is reported by Coverity.  The algorithm description at
ftp://ftp.icm.edu.pl/packages/ggi/doc/hw/sparc/Sparc.pdf  suggests
that the 32-bit parts of rs2, after the left shift, is treated
as a 64-bit integer.  Bits 32 and above are used to do the
saturating truncation.

Use a cast to unsigned in order to placate ubsan for negative
inputs, and do so in the other fpack* instructions too.

Signed-off-by: Paolo Bonzini<address@hidden>
---
  target-sparc/vis_helper.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <address@hidden>


r~



reply via email to

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