qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH v2] ppc/pnv: Fix potential overflow in I2C model


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2] ppc/pnv: Fix potential overflow in I2C model
Date: Thu, 9 Nov 2023 20:19:07 +0100
User-agent: Mozilla Thunderbird

On 9/11/23 18:15, Cédric Le Goater wrote:
Coverity warns that "i2c_bus_busy(i2c->busses[i]) << i" might overflow
because the expression is evaluated using 32-bit arithmetic and then
used in a context expecting a uint64_t.

While we are at it, introduce a PNV_I2C_MAX_BUSSES constant and check
the number of busses at realize time.

Fixes: Coverity CID 1523918
Cc: Glenn Miles <milesg@linux.vnet.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

  v2: - check PNV_I2C_MAX_BUSSES in realize
      - removed extra space before cast.

  hw/ppc/pnv_i2c.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

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