From patchwork Thu May 11 10:23:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Stojaczyk, DariuszX" X-Patchwork-Id: 24215 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 3240358D1; Thu, 11 May 2017 08:47:23 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C0EB85599 for ; Thu, 11 May 2017 08:47:21 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 10 May 2017 23:47:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,323,1491289200"; d="scan'208";a="85447292" Received: from gklab-246-153.igk.intel.com (HELO Sent) ([10.217.246.153]) by orsmga002.jf.intel.com with SMTP; 10 May 2017 23:47:18 -0700 Received: by Sent (sSMTP sendmail emulation); Thu, 11 May 2017 12:25:04 +0200 From: Dariusz Stojaczyk To: dev@dpdk.org Cc: Dariusz Stojaczyk Date: Thu, 11 May 2017 12:23:27 +0200 Message-Id: <1494498209-77217-1-git-send-email-dariuszx.stojaczyk@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH 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. Change-Id: I02293cd4bcddef14d2bbf314c79d8c65fc44e555 Signed-off-by: Dariusz Stojaczyk --- 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;