From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agsKp-0008L1-9U for qemu-devel@nongnu.org; Fri, 18 Mar 2016 07:12:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agsKo-0003jn-BU for qemu-devel@nongnu.org; Fri, 18 Mar 2016 07:12:51 -0400 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]:35027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agsKo-0003jI-4z for qemu-devel@nongnu.org; Fri, 18 Mar 2016 07:12:50 -0400 Received: by mail-io0-x242.google.com with SMTP id 124so1968132iov.2 for ; Fri, 18 Mar 2016 04:12:50 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160318093519.GA16661@stefanha-x1.localdomain> References: <1458057598-11041-1-git-send-email-dhannawatpooja1@gmail.com> <20160317145025.GN14062@stefanha-x1.localdomain> <56EB34A7.9030601@redhat.com> <20160318093519.GA16661@stefanha-x1.localdomain> Date: Fri, 18 Mar 2016 16:42:49 +0530 Message-ID: From: Pooja Dhannawat Content-Type: multipart/alternative; boundary=001a113ecc20d39597052e50d3f1 Subject: Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Paolo Bonzini , qemu-devel@nongnu.org --001a113ecc20d39597052e50d3f1 Content-Type: text/plain; charset=UTF-8 On Fri, Mar 18, 2016 at 3:05 PM, Stefan Hajnoczi wrote: > On Thu, Mar 17, 2016 at 11:50:15PM +0100, Paolo Bonzini wrote: > > > > > > On 17/03/2016 16:31, Pooja Dhannawat wrote: > > > > > > > > > On Thu, Mar 17, 2016 at 8:20 PM, Stefan Hajnoczi > > > wrote: > > > > > > On Tue, Mar 15, 2016 at 09:29:58PM +0530, Pooja Dhannawat wrote: > > > > @@ -170,8 +170,8 @@ static void net_socket_send(void *opaque) > > > > s->index = 0; > > > > s->packet_len = 0; > > > > s->nc.link_down = true; > > > > - memset(s->buf, 0, sizeof(s->buf)); > > > > > > This change is unrelated to allocating buf1 on the heap. What is > the > > > purpose of this line? > > > > > > > > > I moved buf from stack to Heap, used g_new(), but I got your point if > we > > > need to initialize it with 0 then I have to keep that one. > > > > > > Other wise doing so it gets whatever garbage it has already. > > > > This is s->buf, not buf. > > Exactly, they are different variables. > > Yes. The line should not be removed. Extremely sorry for the noise and my terrible confusion. Will mail the updated patch. > Stefan > --001a113ecc20d39597052e50d3f1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Fri, Mar 18, 2016 at 3:05 PM, Stefan Hajnoczi <= stefanha@gmail.com<= /a>> wrote:
On Thu, Mar 17, = 2016 at 11:50:15PM +0100, Paolo Bonzini wrote:
>
>
> On 17/03/2016 16:31, Pooja Dhannawat wrote:
> >
> >
> > On Thu, Mar 17, 2016 at 8:20 PM, Stefan Hajnoczi <
stefanha@gmail.com
> > <mailto:stefanha@gmail.c= om>> wrote:
> >
> >=C2=A0 =C2=A0 =C2=A0On Tue, Mar 15, 2016 at 09:29:58PM +0530, Pooj= a Dhannawat wrote:
> >=C2=A0 =C2=A0 =C2=A0> @@ -170,8 +170,8 @@ static void net_socke= t_send(void *opaque)
> >=C2=A0 =C2=A0 =C2=A0>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s->i= ndex =3D 0;
> >=C2=A0 =C2=A0 =C2=A0>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s->p= acket_len =3D 0;
> >=C2=A0 =C2=A0 =C2=A0>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 s->n= c.link_down =3D true;
> >=C2=A0 =C2=A0 =C2=A0> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset(s->= ;buf, 0, sizeof(s->buf));
> >
> >=C2=A0 =C2=A0 =C2=A0This change is unrelated to allocating buf1 on= the heap.=C2=A0 What is the
> >=C2=A0 =C2=A0 =C2=A0purpose of this line?
> >
> >
> > I moved buf from stack to Heap, used g_new(), but I got your poin= t if we
> > need to initialize it with 0 then I have to keep that one.
> >
> > Other wise doing so it gets whatever garbage it has already.
>
> This is s->buf, not buf.

Exactly, they are different variables.

Yes.=C2=A0
The line should not be removed.
Extremely = sorry for the noise and my terrible confusion.=C2=A0
Will mail th= e updated patch.
Stefan

--001a113ecc20d39597052e50d3f1--