From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 6D3E3B62 for ; Wed, 6 Apr 2016 12:15:17 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id n3so56101115wmn.0 for ; Wed, 06 Apr 2016 03:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=dcOAM9vw/Z4w6RaL/RTf3EoU4/sxizUjN1g7vAd3X9o=; b=PhjMezA9m3fp5XvCwova2R+X/prsW5Ux0oPCMriVBRPRcUDpSO7SooRb5wxBb7UGUx GWUTwayAZTuxY6j9te09+iF2notpeHiUdgffCr5XU0W0Q1UrmLgVdiwZlMYJBNkpTneD SxpeLntPYIc1SsM3h/TIN21QhcJqH6/gSP379pLHLkIOZIEXwagWcQonCCB5t8NwHTIv ccupykRIX+7MRWSdDX7dYYgrQDYa60gqcMkBRmIMmH6DaMGAEMmV4TaDwf2a4mfsuha8 yEWqjv32fw6S40lsf+4FpMvPf2kUVio2MalhB7zToyrwGzEYSvdDcRuyFoQ1adUPXoW2 K4qQ== 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:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=dcOAM9vw/Z4w6RaL/RTf3EoU4/sxizUjN1g7vAd3X9o=; b=GNsHNsNjg5qzkEnwf5WzEzCHwi7l9klgKTm1RjD82zMyg5a7gGYMrKqxDqk0HRb3FN 3MMoHnPSEqvFJSS5WHZSSE9jZE3t8PpoZsq9t5C40+mFqP4ZgfEANojCVUpRp0xpPwiL xvzc6stpeb8OFHWR6Ya1opyS/hlQdVitMpGCQdiRet6b/W/qBcSADARnmLiXOZCPeOfe A9gJP+/+l48cw+JFoJu6dBLHGFKNB3LyFsaB2/mV52uPUfbWPatsTSKHO1wi3lm4rUky x42JBv13JLWJXgAXw1cy4Tnk2tkdG+rLDY4EeNQ7rsXcLpbRTS6tYjN6YY17qcA29BPu m9uA== X-Gm-Message-State: AD7BkJJ6oFY9ae8/ol3nHEFauZG8v20PXQTsPqpzPtzroQc+0y3CJZmfhFB/lKYQZJZNp6oi X-Received: by 10.194.60.165 with SMTP id i5mr31522414wjr.178.1459937717335; Wed, 06 Apr 2016 03:15:17 -0700 (PDT) Received: from xps13.localnet (91.111.75.86.rev.sfr.net. [86.75.111.91]) by smtp.gmail.com with ESMTPSA id d2sm2450959wjf.28.2016.04.06.03.15.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Apr 2016 03:15:16 -0700 (PDT) From: Thomas Monjalon To: Olivier Matz Cc: dev@dpdk.org, "Van Haaren, Harry" , "Mcnamara, John" Date: Wed, 06 Apr 2016 12:13:38 +0200 Message-ID: <3160973.YKeoJRatud@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: References: <1459784718-22856-1-git-send-email-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] xstats: fix behavior when a null array is provided 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: Wed, 06 Apr 2016 10:15:17 -0000 2016-04-05 11:06, Van Haaren, Harry: > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz > > Subject: [dpdk-dev] [PATCH] xstats: fix behavior when a null array is provided > > > > Coverity reports an issue in ethdev: > > > > *** CID 124562: Null pointer dereferences (FORWARD_NULL) > > /lib/librte_ether/rte_ethdev.c: 1518 in rte_eth_xstats_get() > > 1512 > > 1513 /* global stats */ > > 1514 for (i = 0; i < RTE_NB_STATS; i++) { > > 1515 stats_ptr = RTE_PTR_ADD(ð_stats, > > 1516 > > rte_stats_strings[i].offset); > > 1517 val = *stats_ptr; > > >>> CID 124562: Null pointer dereferences (FORWARD_NULL) > > >>> Dereferencing null pointer "xstats". > > 1518 snprintf(xstats[count].name, > > sizeof(xstats[count].name), > > 1519 "%s", rte_stats_strings[i].name); > > 1520 xstats[count++].value = val; > > 1521 } > > 1522 > > 1523 /* per-rxq stats */ > > > > If a user calls rte_eth_xstats_get(portid, NULL, n) with n != 0, > > it may result in a crash. Although the API documentation says that > > n is the size of the table and xstats can be NULL if n == 0, we > > can add an additional check here to make Coverity happy. > > > > In that case, the return value is the same than when n == 0 is > > passed, it returns the number of statistics. > > > > Fixes: ce757f5c9a ("ethdev: new method to retrieve extended statistics") > > Signed-off-by: Olivier Matz > > I'm unsure on how verbose commit messages are ideal, > but there's certainly enough description here :) > > Acked-by: Harry van Haaren Applied, thanks