From: Paolo Bonzini <pbonzini@redhat.com>
To: Julio Faracco <jcfaracco@gmail.com>, qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v3] i386: Fix GCC warning with snprintf when HAX is enabled
Date: Mon, 2 Mar 2020 01:05:37 +0100 [thread overview]
Message-ID: <52fadd00-d59a-0096-52a2-f44f49a85d7b@redhat.com> (raw)
In-Reply-To: <20200301192156.19357-1-jcfaracco@gmail.com>
On 01/03/20 20:21, Julio Faracco wrote:
> + assert(vm_id < 0);
> +
> + if (snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d",
> + vm_id) < 0)
> + return NULL;
> +
> return name;
> }
>
> @@ -140,8 +145,12 @@ static char *hax_vcpu_devfs_string(int vm_id, int vcpu_id)
> return NULL;
> }
>
> - snprintf(name, sizeof HAX_VCPU_DEVFS, "/dev/hax_vm%02d/vcpu%02d",
> - vm_id, vcpu_id);
> + assert(vm_id < 0 || vcpu_id < 0);
> +
> + if (snprintf(name, sizeof HAX_VCPU_DEVFS, "/dev/hax_vm%02d/vcpu%02d",
> + vm_id, vcpu_id) < 0)
Can you just replace snprintf with g_strdup_printf instead? Then you
can also remove MAX_VM_ID and MAX_VCPU_ID.
Paolo
next prev parent reply other threads:[~2020-03-02 0:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-01 19:21 [PATCH v3] i386: Fix GCC warning with snprintf when HAX is enabled Julio Faracco
2020-03-02 0:05 ` Paolo Bonzini [this message]
2020-03-02 1:58 ` Julio Faracco
2020-03-02 8:03 ` Paolo Bonzini
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=52fadd00-d59a-0096-52a2-f44f49a85d7b@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jcfaracco@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).