From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 759E61E2F for ; Tue, 10 Jan 2017 14:08:52 +0100 (CET) Received: by mail-wm0-f53.google.com with SMTP id c85so127397817wmi.1 for ; Tue, 10 Jan 2017 05:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=Z9OVjW/oi8+/whLWdYoDRu8hhhJZyXLGVsLW6zvYgvc=; b=hyRB4YcxL8CnnZvyfgQmj3DxaGTlJ7MkTryuhaoi6+byD5YS3/hiPNYv3pYd5NRgr8 Te54yuhp2N4GzrjIag2/WOjYd8iIt163fA80grI1D4643y37UzfuP3mD1JQQS6x5wFh5 uw8k4Yr81iXvhdYMfJ7TYiwLJ7SiEb+M7o9fyFG6wvTQ4/j76WUdxz7bBK53RZAmE3/m EAktJu2E5l0jgMUZp05g8IXTP0u17GcwoFxZ+iRf1wDAAJcKJKuhVNoAK++9z9S8jN0N o8mosUCMDc7ci51wuXSl45uz9Y1s4bKGTsIBdYJLX/z3w9X3SzQabVGntuYZ1HtSy8ug Lb5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Z9OVjW/oi8+/whLWdYoDRu8hhhJZyXLGVsLW6zvYgvc=; b=AYPu43umIIkz43wriMhdTEnkaLDC/0pipkZrDOeXaFSXvxywldjv5xtpQVqI+6XGtv aKy3vvtx4OUVQG1LBbzuHKsZdkYoc00TQx+Z/jXu9j4x0x2Cw5Glb63wh+iM2s6o9cOh qGevUnLmROgaR9xypS/GroW6nFTsunLLYzwRHb0mcVDnpzIaZwZO4oDItw3zaXI25ufD uaM3FxtnVmoLE4tv+lum/PGSt/94ai0tUxptL0KcoiCbBzYsVKd5ox6g28Z0+RVBGXRc kVz4GkrIypt23RG4cT+ww+/JU++ZlqIbWon+ThQFKA22pzs01aTP7sxnCNdi87nv/8iL dJ4Q== X-Gm-Message-State: AIkVDXLD5j7TeONlZSVLOkDryDF9FHrJQOHQk6SR3yiyLyCQgGM44r4Ie6Sa40bRP3ZQZ3Gk X-Received: by 10.28.203.75 with SMTP id b72mr2092374wmg.110.1484053732042; Tue, 10 Jan 2017 05:08:52 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id ks1sm2178013wjb.26.2017.01.10.05.08.50 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 10 Jan 2017 05:08:51 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Tue, 10 Jan 2017 14:08:26 +0100 Message-Id: <4bf4692b3d38d6f807855ad16d4223ba06107753.1484046037.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 1/5] app/testpmd: fix array bounds checks 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: , X-List-Received-Date: Tue, 10 Jan 2017 13:08:52 -0000 This commit addresses several obvious issues reported by Coverity (139596, 139597, 139598 and 139599) with array bounds checks in functions related to the flow API. Fixes: 938a184a1870 ("app/testpmd: implement basic support for flow API") Signed-off-by: Adrien Mazarguil --- app/test-pmd/config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 9716ce7..e1af064 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -884,7 +884,7 @@ port_flow_new(const struct rte_flow_attr *attr, do { struct rte_flow_item *dst = NULL; - if ((unsigned int)item->type > RTE_DIM(flow_item) || + if ((unsigned int)item->type >= RTE_DIM(flow_item) || !flow_item[item->type].name) goto notsup; if (pf) @@ -918,7 +918,7 @@ port_flow_new(const struct rte_flow_attr *attr, do { struct rte_flow_action *dst = NULL; - if ((unsigned int)action->type > RTE_DIM(flow_action) || + if ((unsigned int)action->type >= RTE_DIM(flow_action) || !flow_action[action->type].name) goto notsup; if (pf) @@ -977,7 +977,7 @@ port_flow_complain(struct rte_flow_error *error) char buf[32]; int err = rte_errno; - if ((unsigned int)error->type > RTE_DIM(errstrlist) || + if ((unsigned int)error->type >= RTE_DIM(errstrlist) || !errstrlist[error->type]) errstr = "unknown type"; else @@ -1146,7 +1146,7 @@ port_flow_query(portid_t port_id, uint32_t rule, printf("Flow rule #%u not found\n", rule); return -ENOENT; } - if ((unsigned int)action > RTE_DIM(flow_action) || + if ((unsigned int)action >= RTE_DIM(flow_action) || !flow_action[action].name) name = "unknown"; else -- 2.1.4