From patchwork Fri Oct 6 16:45:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fischetti, Antonio" X-Patchwork-Id: 822594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7wXV2Z1Cz9sPs for ; Sat, 7 Oct 2017 03:47:06 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 840D9B01; Fri, 6 Oct 2017 16:45:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 640DEAF4 for ; Fri, 6 Oct 2017 16:45:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2F457470 for ; Fri, 6 Oct 2017 16:45:17 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Oct 2017 09:45:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,484,1500966000"; d="scan'208";a="135960650" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga004.jf.intel.com with ESMTP; 06 Oct 2017 09:45:15 -0700 From: antonio.fischetti@intel.com To: dev@openvswitch.org Date: Fri, 6 Oct 2017 17:45:05 +0100 Message-Id: <1507308307-25032-4-git-send-email-antonio.fischetti@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1507308307-25032-1-git-send-email-antonio.fischetti@intel.com> References: <1507308307-25032-1-git-send-email-antonio.fischetti@intel.com> X-Spam-Status: No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v4 4/6] netdev-dpdk: assert mempool names. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Replace if statement with an assert. CC: Darrell Ball CC: Ciara Loftus CC: Kevin Traynor CC: Aaron Conole Signed-off-by: Antonio Fischetti --- lib/netdev-dpdk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 00335f2..ac3c23d 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -501,9 +501,7 @@ dpdk_mp_name(struct dpdk_mp *dmp) char *mp_name = xcalloc(RTE_MEMPOOL_NAMESIZE, sizeof *mp_name); int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u", h, dmp->socket_id, dmp->mtu, dmp->mp_size); - if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) { - return NULL; - } + ovs_assert(ret >= 0 && ret < RTE_MEMPOOL_NAMESIZE); return mp_name; }