qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Krempa <pkrempa@redhat.com>
To: "Миронов Сергей Владимирович" <mironov@fintech.ru>
Cc: "libvirt-security@redhat.com" <libvirt-security@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"libvir-list@redhat.com" <libvir-list@redhat.com>,
	"sdl.qemu@linuxtesting.org" <sdl.qemu@linuxtesting.org>
Subject: Re: [sdl-qemu] [PATCH 1/1] No checks, dereferencing possible
Date: Thu, 14 Sep 2023 12:22:26 +0200	[thread overview]
Message-ID: <ZQLe4uI2xu1cKkB5@angien.pipo.sk> (raw)
In-Reply-To: <59e6590ea8a04de788f69709ea4c54f8@fintech.ru>

On Thu, Sep 14, 2023 at 09:44:16 +0000, Миронов Сергей Владимирович wrote:
> No checks, dereferencing possible.
> 
> 
> Return value of a function 'virDomainChrSourceDefNew'
> is dereferenced at qemu_command.c without checking
> for NULL, but it is usually checked for this function.

This description here doesn't make sense. You are checking the presence
of 'privateData' in 'virDomainVideoDef'.

> 
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> 
> Fixes: 1f85f0967b ("ci: jobs.sh: Add back '--no-suite syntax-check --print-errorlogs'")
> 
> Signed-off-by: Sergey Mironov <mironov@fintech.ru>
> 
> ---
> src/qemu/qemu_command.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index e84374b4cf..8d11972c88 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4698,6 +4698,8 @@ qemuBuildVideoCommandLine(virCommand *cmd,
>              g_autofree char *name = g_strdup_printf("%s-vhost-user", video->info.alias);
>              qemuDomainChrSourcePrivate *chrsrcpriv = QEMU_DOMAIN_CHR_SOURCE_PRIVATE(chrsrc);
> 
> +           if (chrsrc == NULL)
> +                   return -1;

This addition doesn't make sense as it's dead code. The private data is
always allocated and checked that it's non-NULL in the qemu driver via
the callback in virDomainVideoDefNew.

Do you have a call trace that would prove me otherwise?



  reply	other threads:[~2023-09-14 10:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  9:44 [sdl-qemu] [PATCH 1/1] No checks, dereferencing possible Миронов Сергей Владимирович
2023-09-14 10:22 ` Peter Krempa [this message]
2023-09-14 15:10   ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQLe4uI2xu1cKkB5@angien.pipo.sk \
    --to=pkrempa@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=libvirt-security@redhat.com \
    --cc=mironov@fintech.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=sdl.qemu@linuxtesting.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).