From: Paolo Bonzini <pbonzini@redhat.com>
To: Julio Faracco <jcfaracco@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
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 09:03:38 +0100 [thread overview]
Message-ID: <69ab86b9-c4b6-d40a-c8c7-4388dadd8573@redhat.com> (raw)
In-Reply-To: <CAENf94+9qHNvCnG05C70=NwUHwwjo050s8oTt0ZB5Q1jpCU7+g@mail.gmail.com>
On 02/03/20 02:58, Julio Faracco wrote:
> Sorry my ignorance, Paolo.
> But why should I remove MAX_{VM,VCPU}_ID?
>
> Did you mean that check?
> if (vm_id > MAX_VM_ID || vcpu_id > MAX_VCPU_ID) {
> fprintf(stderr, "Too big vm id %x or vcpu id %x\n", vm_id, vcpu_id);
> return NULL;
> }
>
> Wouldn't it be dangerous?
No, the check is only needed to avoid the buffer truncation from
snprintf. If you use g_strdup_printf it's not needed anymore because
there can be no truncation.
Paolo
prev parent reply other threads:[~2020-03-02 8:04 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
2020-03-02 1:58 ` Julio Faracco
2020-03-02 8:03 ` Paolo Bonzini [this message]
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=69ab86b9-c4b6-d40a-c8c7-4388dadd8573@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).