From patchwork Thu May 11 14:33:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Stojaczyk, DariuszX" X-Patchwork-Id: 24239 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 290AD47CE; Thu, 11 May 2017 13:02:23 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 8DAA814EC for ; Thu, 11 May 2017 13:02:21 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2017 04:02:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.38,324,1491289200"; d="scan'208"; a="1146576232" Received: from gklab-246-153.igk.intel.com (HELO Sent) ([10.217.246.153]) by fmsmga001.fm.intel.com with SMTP; 11 May 2017 04:02:17 -0700 Received: by Sent (sSMTP sendmail emulation); Thu, 11 May 2017 16:37:56 +0200 From: Dariusz Stojaczyk To: dev@dpdk.org Cc: Dariusz Stojaczyk Date: Thu, 11 May 2017 16:33:10 +0200 Message-Id: <1494513192-85863-2-git-send-email-dariuszx.stojaczyk@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494513192-85863-1-git-send-email-dariuszx.stojaczyk@intel.com> References: <1494500208-78788-1-git-send-email-dariuszx.stojaczyk@intel.com> <1494513192-85863-1-git-send-email-dariuszx.stojaczyk@intel.com> Subject: [dpdk-dev] [PATCH v3 1/3] vhost: fix malloc in rte_vhost_get_mem_table() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Amount of allocated memory was too small, causing buffer overflow. Signed-off-by: Dariusz Stojaczyk Reviewed-by: Jens Freimann --- lib/librte_vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 0b19d2e..1f565fb 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -369,7 +369,7 @@ rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem) return -1; size = dev->mem->nregions * sizeof(struct rte_vhost_mem_region); - m = malloc(size); + m = malloc(sizeof(struct rte_vhost_memory) + size); if (!m) return -1;