[PATCH 0/2] avoid integer overflow

Yifei Jiang posted 2 patches 4 years, 1 month ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200316114050.3167-1-jiangyifei@huawei.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <rth@twiddle.net>
accel/tcg/cputlb.c |  6 +++---
tcg/tcg-op-gvec.c  | 18 +++++++++---------
tcg/tcg-op-vec.c   |  4 ++--
3 files changed, 14 insertions(+), 14 deletions(-)
[PATCH 0/2] avoid integer overflow
Posted by Yifei Jiang 4 years, 1 month ago
the constant default type is "int", when the constant is shifted to the left,
it may exceed 32 bits, resulting in integer overflowing. So constant type need
change to "long"

Yifei Jiang (2):
  tcg: avoid integer overflow
  accel/tcg: avoid integer overflow

 accel/tcg/cputlb.c |  6 +++---
 tcg/tcg-op-gvec.c  | 18 +++++++++---------
 tcg/tcg-op-vec.c   |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

-- 
2.19.1



Re: [PATCH 0/2] avoid integer overflow
Posted by Peter Maydell 4 years, 1 month ago
On Mon, 16 Mar 2020 at 12:25, Yifei Jiang <jiangyifei@huawei.com> wrote:
>
> the constant default type is "int", when the constant is shifted to the left,
> it may exceed 32 bits, resulting in integer overflowing. So constant type need
> change to "long"

"long" would not in general be the right type to use in cases where
 we do need to make this change, because "long" also can
be only 32 bits wide on some hosts.

thanks
-- PMM