From patchwork Tue Apr 27 06:41:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyunjian X-Patchwork-Id: 1470561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FTsd32BBHz9sSs for ; Tue, 27 Apr 2021 16:42:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5341340443; Tue, 27 Apr 2021 06:42:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t_vynQc2Ji3e; Tue, 27 Apr 2021 06:42:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTP id 8A9A74043A; Tue, 27 Apr 2021 06:42:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5C719C000E; Tue, 27 Apr 2021 06:42:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id ACF0FC000B for ; Tue, 27 Apr 2021 06:42:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8B3014059A for ; Tue, 27 Apr 2021 06:42:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S0MzcUKObSz0 for ; Tue, 27 Apr 2021 06:42:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4D74C40597 for ; Tue, 27 Apr 2021 06:42:04 +0000 (UTC) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FTsYv52vdzBscj; Tue, 27 Apr 2021 14:39:31 +0800 (CST) Received: from localhost (10.174.242.151) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 27 Apr 2021 14:41:53 +0800 From: wangyunjian To: , Date: Tue, 27 Apr 2021 14:41:46 +0800 Message-ID: <1619505706-19876-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.174.242.151] X-CFilter-Loop: Reflected Cc: dingxiaoxiong@huawei.com Subject: [ovs-dev] [PATCH] bridge: fix type mismatch X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Yunjian Wang Currently the function ofproto_set_flow_limit() was not checking 'limit' value. It maybe negative, which will be lead to a big unsigned value. The 'limit' should never be negative so it's better to just use smap_get_uint() to get it right. And fix ofproto_set_max_idle(), ofproto_set_min_revalidate_pps(), ofproto_set_max_revalidator() and ofproto_set_bundle_idle_timeout() together. Signed-off-by: Yunjian Wang --- vswitchd/bridge.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 5ed7e8234..985e05099 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -822,19 +822,19 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) COVERAGE_INC(bridge_reconfigure); - ofproto_set_flow_limit(smap_get_int(&ovs_cfg->other_config, "flow-limit", + ofproto_set_flow_limit(smap_get_uint(&ovs_cfg->other_config, "flow-limit", OFPROTO_FLOW_LIMIT_DEFAULT)); - ofproto_set_max_idle(smap_get_int(&ovs_cfg->other_config, "max-idle", + ofproto_set_max_idle(smap_get_uint(&ovs_cfg->other_config, "max-idle", OFPROTO_MAX_IDLE_DEFAULT)); - ofproto_set_max_revalidator(smap_get_int(&ovs_cfg->other_config, + ofproto_set_max_revalidator(smap_get_uint(&ovs_cfg->other_config, "max-revalidator", OFPROTO_MAX_REVALIDATOR_DEFAULT)); ofproto_set_min_revalidate_pps( - smap_get_int(&ovs_cfg->other_config, "min-revalidate-pps", + smap_get_uint(&ovs_cfg->other_config, "min-revalidate-pps", OFPROTO_MIN_REVALIDATE_PPS_DEFAULT)); ofproto_set_vlan_limit(smap_get_int(&ovs_cfg->other_config, "vlan-limit", LEGACY_MAX_VLAN_HEADERS)); - ofproto_set_bundle_idle_timeout(smap_get_int(&ovs_cfg->other_config, + ofproto_set_bundle_idle_timeout(smap_get_uint(&ovs_cfg->other_config, "bundle-idle-timeout", 0)); ofproto_set_threads( smap_get_int(&ovs_cfg->other_config, "n-handler-threads", 0),