From patchwork Sat Mar 12 03:28:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pooja Dhannawat X-Patchwork-Id: 8570961 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5DF219F44D for ; Sat, 12 Mar 2016 03:32:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BECAF20361 for ; Sat, 12 Mar 2016 03:32:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2492A2035E for ; Sat, 12 Mar 2016 03:32:04 +0000 (UTC) Received: from localhost ([::1]:58796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeaHb-0004rc-IT for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 22:32:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeaGx-0004AH-EU for qemu-devel@nongnu.org; Fri, 11 Mar 2016 22:31:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeaGt-0003W0-Es for qemu-devel@nongnu.org; Fri, 11 Mar 2016 22:31:23 -0500 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:33571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeaGt-0003Vr-7a for qemu-devel@nongnu.org; Fri, 11 Mar 2016 22:31:19 -0500 Received: by mail-pa0-x22b.google.com with SMTP id fl4so113541238pad.0 for ; Fri, 11 Mar 2016 19:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=pK9evSSJUM23+6iRSgkBz9T4pVYqtMEQgzFE785QvQk=; b=1ERRUxNZiULAaSdSejQREXmMScjuCAvpjxIyTXJ3tJL3uyYGQNH+4xU9Sp4XJx6o4A HYB4GNmpIHVHxYLsLsuXdlcENwUdIXb26H+iR2Qj2/4XuM47M9W4d5g9SrebFpFAXVIs wbjK1npQo+pqTqQVIrzGgVizfgi7LowshbG/nZrOnXeW7Ocac58bC37rugKCYDr+qLEu ftb69jP8N7c8zSnCrRtPTFb4Ujx0dht+fqZuLTY3ItzGquRtXyCcNjrWUJE1F9wI2nPg IA9yEd5b3nVntSLzjXgofmeS4qYpQ6q/nNznrwweEBhx7MY32fn8MQmKqk+nvNHdQJ8w h6Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=pK9evSSJUM23+6iRSgkBz9T4pVYqtMEQgzFE785QvQk=; b=S9V3vqOmyhGFEnge5PRDlfjritBOUOQZ0XMiDDYa894f9lDHZbwLNXFD8PypTp4n94 KUwYzCZKoGIMIl5TpCSL45qkrKn2OqHJ/2cDOlYZQFW0nIrjfGYmKjVhFLF3A7GCIg9r aoB7lHj2eLmtH0B4tj+/TPMI6HxKN/3fzNDSxOZNvUjgrpkv4YKdhRLy4G40oqnpOW/l J/o8Nh09wvWWM/yE0+2xSCkGTG0TVVX19O2XMegSwC89BSOOr8uvoKsTeR8vqM6bkc8L I6Vcr+gyP/FyLnmwymfCZl/0ByH005j6vtbhycObLwECNNEZeWEAqap3hXAkc8Q/rr0c hOug== X-Gm-Message-State: AD7BkJKM/UP0b4HRqTg3YUuv60LX+kHpk2pD7qVhSAnu7RvT2IvFjoKClbxa+oeccAUsog== X-Received: by 10.66.119.71 with SMTP id ks7mr21109812pab.151.1457753478161; Fri, 11 Mar 2016 19:31:18 -0800 (PST) Received: from localhost.localdomain ([183.87.60.98]) by smtp.gmail.com with ESMTPSA id 27sm16009293pfo.58.2016.03.11.19.31.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Mar 2016 19:31:17 -0800 (PST) From: Pooja Dhannawat To: qemu-devel@nongnu.org Date: Sat, 12 Mar 2016 08:58:58 +0530 Message-Id: <1457753338-22089-1-git-send-email-dhannawatpooja1@gmail.com> X-Mailer: git-send-email 2.5.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::22b Subject: [Qemu-devel] [Patch 1/1] net/socket: Allocating Large sized arrays to heap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_HI, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Pooja Dhannawat --- net/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/socket.c b/net/socket.c index e32e3cb..483dcac 100644 --- a/net/socket.c +++ b/net/socket.c @@ -147,10 +147,10 @@ static void net_socket_send(void *opaque) NetSocketState *s = opaque; int size, err; unsigned l; - uint8_t buf1[NET_BUFSIZE]; + uint8_t *buf1 = g_new(uint8_t, 1); const uint8_t *buf; - size = qemu_recv(s->fd, buf1, sizeof(buf1), 0); + size = qemu_recv(s->fd, (uint8_t *)buf1, sizeof(uint8_t), 0); if (size < 0) { err = socket_error(); if (err != EWOULDBLOCK) @@ -170,7 +170,6 @@ 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)); memset(s->nc.info_str, 0, sizeof(s->nc.info_str)); return; @@ -222,6 +221,7 @@ static void net_socket_send(void *opaque) break; } } + g_free(buf1); } static void net_socket_send_dgram(void *opaque)