qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] virtio-ccw.c vs larger VIRTIO_QUEUE_MAX (coverity warning CID 1390619)
@ 2018-05-14 18:12 Peter Maydell
  2018-05-15  8:32 ` Cornelia Huck
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2018-05-14 18:12 UTC (permalink / raw)
  To: QEMU Developers, Cornelia Huck; +Cc: Jason Wang

Hi; Coverity has I think enabled a new warning recently, which
is triggering on virtio_ccw_notify() in hw/s390x/virtio-ccw.c
(CID 1390619).

This function does
    indicators |= 1ULL << vector;
but the code is guarded only by
    if (vector < VIRTIO_QUEUE_MAX) {

That used to be OK when VIRTIO_QUEUE_MAX was 64, but in
commit b829c2a98f1 it was raised to 1024, and this is no longer
a useful guard. The commit message for b829c2a98f1 suggests that
this is a "can't happen" case -- is that so? If so then the
else {} part of the code and an earlier check on
"if (vector >= VIRTIO_QUEUE_MAX + 64)" are dead code.
However it looks like the device_plugged method is also
checking VIRTIO_QUEUE_MAX, rather than 64.

If this is a false positive, then an assert() in
virtio_ccw_notify() and cleaning up the dead code would
help placate coverity.

(Other odd code in that function:
    vector = 0;
    [...]
    indicators |= 1ULL << vector;
is that really supposed to ignore the input vector number?)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-05-15 15:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-14 18:12 [Qemu-devel] virtio-ccw.c vs larger VIRTIO_QUEUE_MAX (coverity warning CID 1390619) Peter Maydell
2018-05-15  8:32 ` Cornelia Huck
2018-05-15 12:00   ` [Qemu-devel] [qemu-s390x] " Halil Pasic
2018-05-15 12:07     ` Peter Maydell
2018-05-15 13:17       ` Halil Pasic
2018-05-15 14:01         ` Cornelia Huck
2018-05-15 15:30           ` Halil Pasic
2018-05-15 15:45             ` Cornelia Huck
2018-05-15 13:37     ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).