From patchwork Fri Nov 4 19:11:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 16940 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 892DA29CF; Fri, 4 Nov 2016 20:11:52 +0100 (CET) Received: from relay.smtp.broadcom.com (unknown [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id A29F82952 for ; Fri, 4 Nov 2016 20:11:49 +0100 (CET) Received: from mail-irv-17.broadcom.com (mail-irv-17.broadcom.com [10.15.198.34]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 5ABCB280472; Fri, 4 Nov 2016 12:11:47 -0700 (PDT) Received: from C02PT1RBG8WP.wifi.aus.avagotech.net (c02pt1rbg8wp.wifi.aus.avagotech.net [10.10.168.137]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 600D382029; Fri, 4 Nov 2016 12:11:46 -0700 (PDT) Date: Fri, 4 Nov 2016 14:11:44 -0500 From: Ajit Khaparde To: dev@dpdk.org Cc: Ferruh Yigit Message-ID: <20161104191144.GA719@C02PT1RBG8WP.wifi.aus.avagotech.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [dpdk-dev] [PATCH 1/3 v3] bnxt: use appropriate data type in bnxt_alloc_vnic_attributes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Prevent the arithmetic in bnxt_alloc_vnic_attributes from causing any unintentional havoc because of the usage of a signed variable. Coverity: 137874 Signed-off-by: Ajit Khaparde --- v1: Previous attempt did not seem complete. v2: simplify the fix by redoing the fix for Coverity 127557 --- drivers/net/bnxt/bnxt_vnic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 205a940..33fdde2 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -175,7 +175,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) struct rte_pci_device *pdev = bp->pdev; const struct rte_memzone *mz; char mz_name[RTE_MEMZONE_NAMESIZE]; - uint16_t entry_length = RTE_CACHE_LINE_ROUNDUP( + uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP( HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) + HW_HASH_KEY_SIZE); uint16_t max_vnics;