qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 7cf745: hw/net/rocker: Avoid undefined shifts


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 7cf745: hw/net/rocker: Avoid undefined shifts with more th...
Date: Tue, 09 Aug 2022 09:43:26 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 7cf745dd9c25f0740dc1009598b58dd8dd989876
      
https://github.com/qemu/qemu/commit/7cf745dd9c25f0740dc1009598b58dd8dd989876
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-08-09 (Tue, 09 Aug 2022)

  Changed paths:
    M hw/net/rocker/rocker.c

  Log Message:
  -----------
  hw/net/rocker: Avoid undefined shifts with more than 31 ports

In rocker_port_phys_link_status() and rocker_port_phys_enable_read()
we construct a 64-bit value with one bit per front-panel port.
However we accidentally do the shift as 32-bit arithmetic, which
means that if there are more than 31 front-panel ports this is
undefined behaviour.

Fix the problem by ensuring we use 64-bit arithmetic for the whole
calculation. (We won't ever shift off the 64-bit value because
ROCKER_FP_PORTS_MAX is 62.)

Resolves: Coverity CID 1487121, 1487160
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>


  Commit: 8d2862327e9f836a87ba9753fbe00da912767b92
      
https://github.com/qemu/qemu/commit/8d2862327e9f836a87ba9753fbe00da912767b92
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-08-09 (Tue, 09 Aug 2022)

  Changed paths:
    M hw/net/rocker/rocker.c

  Log Message:
  -----------
  Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging

# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1
#
# iQEcBAABAgAGBQJi8iLAAAoJEO8Ells5jWIRrdMIAI1T5lgOhv2DfHXA6bElokIx
# 10NQ0dG5IBhO6l56p6Um95+tMDMfYBDjc8YOI1qv3L1PZOXdeHjs2ldUg8f0cmFP
# asvY1EJJW4SlCI0hk/Jb6oXf8BoVnNEnMmNGg8qRmVyEw2sFYkNhhA9dXH+537GN
# K0ZFOmfsYpn3EzKyqooln8XLT9lPsXX9LC1Oh0Jz1YmRn6y8/rngR1DWAEyr6MnL
# 5iGIyv5VEdeU1sQJRrH9DyCCGLlILCCUa2yo1RkV+Ac/qPdKWfkyE6K6kUelzGbp
# qqP9+rDpF3LwokqAI+8tJCwc6WqLL3Y/Ddb1J6gzydh8WcszjlXPjcBn8FeKXzk=
# =hAhp
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Aug 2022 02:02:56 AM PDT
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) 
<jasowang@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* tag 'net-pull-request' of https://github.com/jasowang/qemu:
  hw/net/rocker: Avoid undefined shifts with more than 31 ports

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/ca5f3d4df1b4...8d2862327e9f



reply via email to

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