qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 07/13] xilinx_spips: Add support for RX disca


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v9 07/13] xilinx_spips: Add support for RX discard and RX drain
Date: Sat, 13 Jan 2018 12:39:31 +0000

On 13 January 2018 at 01:04, francisco iglesias
<address@hidden> wrote:
> CID 1383841 (#2 of 4): Uninitialized scalar variable (UNINIT)29.
> uninit_use_in_call: Using uninitialized value (uint32_t)tx_rx[0] when
> calling
> ssi_transfer.
>
> This is correct, tx_rx is used uninitialized but since we are transmitting
> dummy cycles the transmitted value (tx_rx[0] in this case) is not used (by
> the flashes), this the reason the code looks like that. Would you like me to
> create a patch for quieting coverity here anyway?

  tx_rx[0] = ssi_transfer(s->spi[bus], (uint32_t)tx_rx[0]);

is effectively using the value (since you don't know what the
thing on the other end of that function is going to do with the
value you pass it. You really don't want to make this code's
correctness depend on the called function never looking at
its argument. If you want to pass a dummy value why not
just use constant 0 or something rather than an uninitialized
variable ?

I think quieting coverity is probably a good idea anyway for
the other false positives (it sounds like it hasn't been able
to determine that paths in the rest of the loop can only occur
if the top of the loop went through a path initializing the
variable. Code like that is also hard for humans to comprehend,
though...)

thanks
-- PMM



reply via email to

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