All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Pooja Dhannawat <dhannawatpooja1@gmail.com>,
	Jaya Tiwari <tiwari.jaya18@gmail.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap
Date: Fri, 18 Mar 2016 16:14:02 +0100	[thread overview]
Message-ID: <56EC1B3A.8020004@redhat.com> (raw)
In-Reply-To: <CAPAwAwjroGkpL_Qq=zwg+fyOHp4tru1kB=Zc8xG23hdDrW5f_Q@mail.gmail.com>



On 18/03/2016 14:49, Pooja Dhannawat wrote:
> 
> 
>             If it is greater than the accepted level, the on-stack
>             buffer is not
>             used and you allocate one that has the right size on the heap.
> 
>         Yes Okay. Thank you for the comments.
>         I had one more question.
>         size = qemu_recv(s->fd, buf1, sizeof(buf1), 0); 
>         The one above returns bytes read into buf1 (if large then bytes
>         equivalent to len(buf1) is read) ?
>         If true, size is the correct measure of buf1? Hence, I should
>         compare the allowed stack size to "size" variable?
> 
>        So isnt here size should be compared to "size" varibale paolo? 
> 
> So instead of comparing with NET_BUFSIZE, should I compare with "size"
> variable? Can you help me with this? 

I was a bit confused myself; this function actually is a bit different
from the others because it does not really need a large buffer.  The
function already takes care of moving data in pieces from buf1 to
s->buf.  If you make the buffer smaller, the only change is that one
call to net_socket_send will process fewer bytes.

So you can just send a trivial patch that changes the size of the array
to something like 2048.

Thanks, and sorry for putting you on a false track!

Paolo

  reply	other threads:[~2016-03-18 15:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 15:59 [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap Pooja Dhannawat
2016-03-17 14:50 ` Stefan Hajnoczi
2016-03-17 15:31   ` Pooja Dhannawat
2016-03-17 22:50     ` Paolo Bonzini
2016-03-18  9:35       ` Stefan Hajnoczi
2016-03-18 11:12         ` Pooja Dhannawat
2016-03-18 11:24       ` Pooja Dhannawat
2016-03-18 11:51         ` Paolo Bonzini
2016-03-18 13:27           ` Jaya Tiwari
2016-03-18 13:29             ` Jaya Tiwari
2016-03-18 13:49               ` Pooja Dhannawat
2016-03-18 15:14                 ` Paolo Bonzini [this message]
2016-03-18 15:58                   ` Pooja Dhannawat

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=56EC1B3A.8020004@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dhannawatpooja1@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=tiwari.jaya18@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.