qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
	qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 7/8] migration: fix unbounded stack for source_return_path_thread
Date: Wed, 9 Mar 2016 13:27:43 +0800	[thread overview]
Message-ID: <20160309052743.GO2377@pxdev.xzpeter.org> (raw)
In-Reply-To: <56DEC4F0.7010306@redhat.com>

On Tue, Mar 08, 2016 at 01:26:24PM +0100, Paolo Bonzini wrote:
> 
> 
> On 08/03/2016 08:00, Peter Xu wrote:
> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > CC: Juan Quintela <quintela@redhat.com>
> > CC: Amit Shah <amit.shah@redhat.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >  migration/migration.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 0129d9f..f1a3976 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -1265,11 +1265,11 @@ static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname,
> >   */
> >  static void *source_return_path_thread(void *opaque)
> >  {
> > +#define __MAX_LEN (512)
> >      MigrationState *ms = opaque;
> >      QEMUFile *rp = ms->rp_state.from_dst_file;
> >      uint16_t header_len, header_type;
> > -    const int max_len = 512;
> > -    uint8_t buf[max_len];
> > +    uint8_t buf[__MAX_LEN];
> >      uint32_t tmp32, sibling_error;
> >      ram_addr_t start = 0; /* =0 to silence warning */
> >      size_t  len = 0, expected_len;
> > @@ -1292,7 +1292,7 @@ static void *source_return_path_thread(void *opaque)
> >  
> >          if ((rp_cmd_args[header_type].len != -1 &&
> >              header_len != rp_cmd_args[header_type].len) ||
> > -            header_len > max_len) {
> > +            header_len > __MAX_LEN) {
> >              error_report("RP: Received '%s' message (0x%04x) with"
> >                      "incorrect length %d expecting %zu",
> >                      rp_cmd_args[header_type].name, header_type, header_len,
> > @@ -1372,6 +1372,7 @@ out:
> >      ms->rp_state.from_dst_file = NULL;
> >      qemu_fclose(rp);
> >      return NULL;
> > +#undef __MAX_LEN
> >  }
> >  
> >  static int open_return_path_on_source(MigrationState *ms)
> > 
> 
> Another compiler false positive that you can fix with ARRAY_SIZE.

Yes, will fix.

Thanks.
Peter

  reply	other threads:[~2016-03-09  5:27 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08  7:00 [Qemu-devel] [PATCH 0/8] Fix several unbounded stack usage Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 1/8] qdict: fix unbounded stack for qdict_array_entries Peter Xu
2016-03-08  8:22   ` Markus Armbruster
2016-03-08 10:19     ` Kevin Wolf
2016-03-08 16:21       ` Eric Blake
2016-03-08 16:30         ` Kevin Wolf
2016-03-08 16:50           ` Daniel P. Berrange
2016-03-09  2:57       ` Peter Xu
2016-03-09  3:04         ` Eric Blake
2016-03-09  3:27           ` Peter Xu
2016-03-09  9:48           ` Kevin Wolf
2016-03-09 13:23             ` Markus Armbruster
2016-03-09 13:57               ` Kevin Wolf
2016-03-09 21:03                 ` Markus Armbruster
2016-03-10  1:30                   ` Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 2/8] block: fix unbounded stack for dump_qdict Peter Xu
2016-03-08  8:12   ` Markus Armbruster
2016-03-08  8:53     ` Fam Zheng
2016-03-08 13:47       ` Markus Armbruster
2016-03-09  3:00         ` Peter Xu
2016-03-08  9:31     ` Peter Xu
2016-03-08 13:50       ` Markus Armbruster
2016-03-08 12:17     ` Paolo Bonzini
2016-03-09  3:18       ` Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 3/8] usb: fix unbounded stack for ohci_td_pkt Peter Xu
2016-03-08 12:20   ` Paolo Bonzini
2016-03-09  4:59     ` Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 4/8] usb: fix unbounded stack for xhci_dma_write_u32s Peter Xu
2016-03-08  7:26   ` Peter Maydell
2016-03-09  5:12     ` Peter Xu
2016-03-08 12:21   ` Paolo Bonzini
2016-03-09  5:08     ` Peter Xu
2016-03-09  7:53       ` Paolo Bonzini
2016-03-09  8:07         ` Peter Xu
2016-03-09  8:34           ` Markus Armbruster
2016-03-09  9:19             ` Peter Xu
2016-03-09 12:52               ` Markus Armbruster
2016-03-09 12:59           ` Paolo Bonzini
2016-03-10  2:07             ` Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 5/8] usb: fix unbounded stack for inotify_watchfn Peter Xu
2016-03-08  7:20   ` Peter Maydell
2016-03-08 12:22     ` Paolo Bonzini
2016-03-09  5:22       ` Peter Xu
2016-03-08 12:22   ` Paolo Bonzini
2016-03-09  5:23     ` Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 6/8] usb: fix unbounded stack for usb_mtp_add_str Peter Xu
2016-03-08  8:10   ` Gerd Hoffmann
2016-03-09  5:29     ` Peter Xu
2016-03-08  7:00 ` [Qemu-devel] [PATCH 7/8] migration: fix unbounded stack for source_return_path_thread Peter Xu
2016-03-08  9:48   ` Juan Quintela
2016-03-08 12:27     ` Paolo Bonzini
2016-03-08 12:26   ` Paolo Bonzini
2016-03-09  5:27     ` Peter Xu [this message]
2016-03-08  7:00 ` [Qemu-devel] [PATCH 8/8] hw/i386: fix unbounded stack for load_multiboot Peter Xu
2016-03-08  7:17   ` Peter Maydell
2016-03-08 12:29   ` Paolo Bonzini
2016-03-09  5:39     ` Peter Xu

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=20160309052743.GO2377@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).