From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id C2E492BE2 for ; Tue, 6 Nov 2018 20:30:09 +0100 (CET) Received: by mail-pf1-f193.google.com with SMTP id u10-v6so818289pfn.9 for ; Tue, 06 Nov 2018 11:30:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jL/gnuK/he83iilyD+bKa4/D434yY1ekNNaaXuYFzj8=; b=eykQ9sWP7PuQ02uCnCCjh9ZKatYFgAB6ojPfnu1jy5hcyZ8N2Lfqc3vOnv9sHqXDrd mvi/UZv3vq1ECTV2oxMnCMasPapEGwoGnyVtwN5beDCK79ZkLe9c0HGOMaZf4rXxzM/I YYyc5H78dmliL3kHurWmn1OjEO2gNOn6c4cuD5wlxNmgyWnNeqT5L84GuSN5h+E4e3LT xYOjAKx2Av+if63fusqADd74S8lN7h5UJbyx0ucPLV4075OtoIzBZU4cdxWorVWKg6gw E9KlCNvxbzUtAF5i4wUcA8PrnyGEL7vglrTVOwvYFHW7iliMC7MrN53FxgKWMiEgXyo0 PsLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jL/gnuK/he83iilyD+bKa4/D434yY1ekNNaaXuYFzj8=; b=tmjScXZRrfNBlssvkJ5YgRPEE7zBRJ2yEi9s+9Rz9S0xkUZ1e+a8tOBObTHnVm4lIb rsMtZTUdhmTy8j0wok9cd1hBoCdW9sYEhmeObPr/PMZ4u2jnY1ca+uJpWNKmYpi0in+2 9qAzrSo6EnF1g6/NnBUoW5vxdcwH5LgW84CjWaopgzhB8rrhdi386L901tVuvjHgUKlk 54W4ToYw30R1jGeY5T5/uOg6hByvVkWQcSSe3/PZroE1kaaL8WOnvVIGmga5vkwjQao6 1rQVDYb1e4MWv34qMoA+iNXccH7f4oxLnexiXV+MlodeHCrowRtkVyTAjAi6BQpzKdzg tNiQ== X-Gm-Message-State: AGRZ1gIa4c3PS7o8b3oJ927+G18hoAhAEr4Pj/XbWApgTlqiVnaVvu+k pQdqoCRFCD/fSgJ0/qL34pqTK0AbdiY= X-Google-Smtp-Source: AJdET5c0tWDxGiMUcOyhHNoTOr/f3EM8oCLmOqHhExdEHTfjJ/X4bKnOclDwT6IOEC0Jl+pTjdyDag== X-Received: by 2002:a62:8c93:: with SMTP id m141-v6mr27088637pfd.239.1541532608566; Tue, 06 Nov 2018 11:30:08 -0800 (PST) Received: from localhost.localdomain ([167.220.105.115]) by smtp.gmail.com with ESMTPSA id a18sm9638633pgj.30.2018.11.06.11.30.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 11:30:07 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 6 Nov 2018 11:30:02 -0800 Message-Id: <20181106193005.5383-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106193005.5383-1-stephen@networkplumber.org> References: <20181106193005.5383-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 1/4] net/failsafe: avoid rte_memcpy if rte_realloc fails 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, 06 Nov 2018 19:30:11 -0000 There is a potential issue seen by static tools if number of multicast addresses is zero, and rte_realloc of zero size fails (ie returns NULL). This won't happen in real world for a couple of reasons: Azure doesn't support multicast (ie this is dead code); and rte_realloc of zero size will never fail, but safe to just always return -ENOMEM of realloc fails. Coverity issue: 323487 Fixes: 901efc0da925 ("net/failsafe: support multicast address list set") Signed-off-by: Stephen Hemminger --- drivers/net/failsafe/failsafe_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 7f8bcd4c69f4..a20953a662e1 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1155,7 +1155,7 @@ fs_set_mc_addr_list(struct rte_eth_dev *dev, mcast_addrs = rte_realloc(PRIV(dev)->mcast_addrs, nb_mc_addr * sizeof(PRIV(dev)->mcast_addrs[0]), 0); - if (mcast_addrs == NULL && nb_mc_addr > 0) { + if (mcast_addrs == NULL) { ret = -ENOMEM; goto rollback; } -- 2.17.1