From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by dpdk.org (Postfix) with ESMTP id D94B85698 for ; Fri, 27 Feb 2015 06:18:31 +0100 (CET) Received: by pdjz10 with SMTP id z10so18374454pdj.12 for ; Thu, 26 Feb 2015 21:18:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5abAYa4y4pesbQP0qppYx3AV0A3CKr/PK+hRbD1wABM=; b=m/0GpAXAOEJUhb6boyeTdlfnA6b7Qo/5pPBNyJIkoAocvV9ht89dj9x98zmd1ETW93 VL1TFtJAc7g7Se2wMtHOsowLouA6GPUgrH7xMyzo2VF6TWxv2YZjFWUO3ZqvmgZlU6AB xOTUioPXfD2YX6UsO0F4tluN3noTteOLgiWTwt1eUJ2876lBlzLTK+HOZNu01/iecQG0 YRtvk2uuZHvJkFuNRde75tswdSW4kHwEOLfWZ4UmaSeFnG7C4dMfy/B6Mspo6FOp8YIw +SIDEkTNy2BuWE+2b/TY2iN93WWSMKNFbw2Cli/Z2nIZy4RoQ0pUCDAgTQpmJdvZ99R3 TzRw== X-Gm-Message-State: ALoCoQmJ9qS2nT6v4ETsnepCAld6QZDESAUKNscNAZQqjIV0nc1PKuEtePHSqkVZs3XqMOBk2Ch9 X-Received: by 10.68.65.42 with SMTP id u10mr20605937pbs.81.1425014311241; Thu, 26 Feb 2015 21:18:31 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id bw9sm2608972pab.39.2015.02.26.21.18.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Feb 2015 21:18:30 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Fri, 27 Feb 2015 14:18:18 +0900 Message-Id: <1425014298-14962-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] librte_pmd_null: Fix build issue with gcc-4.7 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: , X-List-Received-Date: Fri, 27 Feb 2015 05:18:32 -0000 This patch fixes following errors with gcc-4.7. lib/librte_pmd_null/rte_eth_null.c:302:28: error: array subscript is above array bounds Reported-by: Mcnamara, John Reported-by: Stephen Hemminger Signed-off-by: Tetsuya Mukawa --- lib/librte_pmd_null/rte_eth_null.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/librte_pmd_null/rte_eth_null.c b/lib/librte_pmd_null/rte_eth_null.c index bb10276..66b0d99 100644 --- a/lib/librte_pmd_null/rte_eth_null.c +++ b/lib/librte_pmd_null/rte_eth_null.c @@ -287,7 +287,7 @@ eth_dev_info(struct rte_eth_dev *dev, static void eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats) { - unsigned i; + unsigned i, num_stats; unsigned long rx_total = 0, tx_total = 0, tx_err_total = 0; const struct pmd_internals *internal; @@ -296,15 +296,17 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats) internal = dev->data->dev_private; memset(igb_stats, 0, sizeof(*igb_stats)); - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && - i < internal->nb_rx_queues; i++) { + num_stats = RTE_MIN((unsigned)RTE_ETHDEV_QUEUE_STAT_CNTRS, + internal->nb_rx_queues); + for (i = 0; i < num_stats; i++) { igb_stats->q_ipackets[i] = internal->rx_null_queues[i].rx_pkts.cnt; rx_total += igb_stats->q_ipackets[i]; } - for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && - i < internal->nb_tx_queues; i++) { + num_stats = RTE_MIN((unsigned)RTE_ETHDEV_QUEUE_STAT_CNTRS, + internal->nb_tx_queues); + for (i = 0; i < num_stats; i++) { igb_stats->q_opackets[i] = internal->tx_null_queues[i].tx_pkts.cnt; igb_stats->q_errors[i] = -- 1.9.1