[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] migration: fix warning for source_return_path_t

From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH] migration: fix warning for source_return_path_thread
Date: Wed, 9 Mar 2016 16:26:06 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Mar 09, 2016 at 08:54:51AM +0100, Paolo Bonzini wrote:
> > @@ -1292,7 +1291,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 > sizeof(buf)) {
> sizeof works fine because buf is an array of bytes, but ARRAY_SIZE is
> better because it works for any type of buffer.

I carefully chose "sizeof" out of "ARRAY_SIZE" as commented by Eric
that, we'd better use sizeof() for char typed buffers.

Will this be related to how header_len is defined? That's something
I do not know... :( E.g., if it's defined as "length in bytes", then
shall we better use sizeof() in all cases?

Anyway, I take my above question as trivial since current buffer is
char typed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]