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

Re: [PATCH for-4.15 5/5] tools/xenstored: Silence coverity when using xs_state_* structures

Hi Andrew,

On 25/02/2021 17:47, Andrew Cooper wrote:
On 25/02/2021 17:41, Julien Grall wrote:
From: Julien Grall <jgrall@xxxxxxxxxx>

Coverity will report unitialized values for every use of xs_state_*
structures in the save part. This can be prevented by using the [0]
rather than [] to define variable length array.

Coverity-ID: 1472398
Coverity-ID: 1472397
Coverity-ID: 1472396
Coverity-ID: 1472395
Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>


 From my understanding, the tools and the hypervisor already rely on GNU
extensions. So the change should be fine.

If not, we can use the same approach as XEN_FLEX_ARRAY_DIM.

Linux has recently purged the use of [0] because it causes sizeof() to
do unsafe things.

Do you have a link to the Linux thread?

Flexible array members is a C99 standard - are we sure that Coverity is
doing something wrong with them?
I have run coverity with one of the structure switched to [0] and it removed the unitialized warning for that specific one.

So clearly coverity is not happy with []. Although, I am not sure why.

Do you have a suggestion how to approach the problem?


Julien Grall



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.