On Fri, 2 Oct 2026 at 17:50, Alexander Mikhalitsyn
<[email protected]> wrote:
>
> From: Alexander Mikhalitsyn <[email protected]>
>
> Coverity suspects nullptr-deref, because we don't check a return value
> of virtio_snd_pcm_get_stream() call in virtio_snd_post_load().
>
> While, techically this code has no issue it's better to change it and
> as Peter has pointed out [1] just follow the same pattern as in other places
> of virtio-snd code:
>     for (uint32_t i = 0; i < vsnd->snd_conf.streams; i++) {
>         VirtIOSoundPCMStream *stream = &vsnd->streams[i];
>         ...
>     }
>
> this way it's perfectly clear that an index is always within the bounds.
>
> Link: 
> https://lore.kernel.org/qemu-devel/cafeaca-k7l5nwk0cc9r8yvvojss6o6eh+i9kxp8lijo4tjn...@mail.gmail.com
>  [1]
> Resolves: Coverity CID 1687010
> Reported-by: Peter Maydell <[email protected]>
> Signed-off-by: Alexander Mikhalitsyn <[email protected]>

Reviewed-by: Peter Maydell <[email protected]>

thanks
-- PMM

Reply via email to