From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22583606A322 for ; Sat, 5 Dec 2026 06:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=bwaERJcE Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24F18427D5; Sat, 5 Dec 2026 07:26:38 +0100 (CET) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTPS id DDA59427B7 for ; Sat, 5 Dec 2026 07:26:31 +0100 (CET) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-8c6c06b3321so1016584b3a.3 for ; Fri, 04 Dec 2026 22:26:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796451990; x=1797056790; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7o3KRBy55/NghK2JInpLdRht94jspptlDDmEjn93CiE=; b=bwaERJcE2brVdp/lwq2g30k3OhNMMLCkA2ExpYiucrs6AFDQU5c0O3TCZ99D1ZjFPn 03qK1ygGKYEWgpU8YED9/QHD9ZEYCnnIzZ7bP/v8g8Uq0CkqYGCIBtHvTUHXF/KiTmJj LMJVdSfhyWEPSqR7dW/vazlZof7YtJ7u4qobYD/yMiNtfRYLKEBvQdNVFpIywIAsoOHd 6C+vZeZ2z0MfmOy7o4SIeUQPpy505V6XniG5vFGm+MPbmPFVz04CX6W8SqyrEggbBBtX E+HpebOPnJAN0iTSbkOVHmC6C/3mEpiCAsWkAQJaBE72V59jGgPUh8UaeSju4bgxuj2u jUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796451990; x=1797056790; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=7o3KRBy55/NghK2JInpLdRht94jspptlDDmEjn93CiE=; b=2FuDhlXl3gsQvqvsK4YbkiYaCALjE1oqdHr9XvIADfikzOpKaMpgziLG1Bj2fWU0QB F7yCG+GmAJXCybA2TFA3guoQrblTUygJc8ZzxHplhD+HeAavzdmIrfrJMkx6g3/ml++j TrrbG30AxIi5cRcFjFTTFCoj2DbQUyVaApLF9zqePg3YbeiZqVE0QlVvLyziWIaSfcMc ApKhwlt0TlDJGKD29NmvC1kGtUOtayMmx8bEfJObGNHEItyCg+NMVvp5l2t/3TKVyT1x FhgN4VKQqNQSHx6LNjFZrwcPFpdX2FvbD+6oEkLPJz33NHRVPW9yLQ+4u9t+8ezPT7/b RFdg== X-Gm-Message-State: AB4q+uFErxFubsVqbfnVkZgpoIDYCxuOG7Stczgk/3P7LNwXek7JL4dZ CGADTHI8I2EwLbYNwEAvecZE3f9pdgUtzgBbSzWE4fQtIGIGbj0ySqZceT8ZXYZkOKhAWC517Q5 cA9eh X-Gm-Gg: AZFdTZfVsgvc3JxOHRuat4jMWikUT21w1i/EQId9J92m68BDdh5LULsAE8Sq11iZeVU Kf97RY9U45hU8FkoFF8ad4JW0bMYq685/StPm2zfw0u4mmiJqXyR/xo6veuKjvfNnLPPawF2C/8 7xMy1sOilK8IvAMfLD9EfOwn8Rv3Gfcr1XP5aGKnpz3MErxRtWzzCJnJDMNY0BpNdxvq0rUV+tz yXtYGJbEq/0UKLuOQSWlgWdavJYNaA/KAdbDfxWlvj+pqmyoLdzt9/CA8sPsZbZhqAZM7it6qZj nE1ApSrvfsbb8TyM+B//TzyWx48fiQ8zSmqiLT8XCXiByQgXHs52gTq8YWOvgmnu7YzUZa6mEBR E/VLtX8vXXo26ZmzZPDjigABqK7KATnrmIRHBohSErNKFp2vFKfDBid3tlZEQcMpJxGQTC6Lmj3 2NI6lXE8OKnD1+2PNEQqSLS3NvUWLdvzZWOUmBXn7VFbsTqwPki4T52+/d3QayAaGXDvaTkAsv7 8rzcJG7Da8LQZOQPGktKzV1ibqJGQMzyUChH0PFwRFnix2GsddpUdTAZq/FWwp1wJ6EYXWjKnHE CV9zkSn3MNYjPwLztDS1dW8WkZkgK2u0kLbKehP/mgKQrLwyoAzR/vkkEhj/c8KeTtcVdQ== X-Received: by 2002:a17:90b:4a83:b0:3b0:97b8:d6b7 with SMTP id 98e67ed59e1d1-3b5e068468fmr3646175a91.42.1796451990364; Fri, 04 Dec 2026 22:26:30 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b6168d3e2fsm1162797a91.2.2026.12.04.22.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 22:26:30 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Xingui Yang , Chengwen Feng Subject: [PATCH v4 45/68] net/hns3: use kvargs numeric helpers Date: Fri, 4 Dec 2026 22:20:22 -0800 Message-ID: <20261205062551.19553-46-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261205062551.19553-1-stephen@networkplumber.org> References: <20260914054912.755403-1-stephen@networkplumber.org> <20261205062551.19553-1-stephen@networkplumber.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 hns3_parse_mbx_time_limit() checks neither errno nor the end pointer, so a malformed value such as "abc" is taken as zero and then silently ignored by the range test that follows. The range test is now part of the conversion, which keeps the existing behaviour of leaving the default in place when the value is out of range. The device capability mask parser is converted separately, later in this series, since it needs the hexadecimal handler rather than a decimal one. Signed-off-by: Stephen Hemminger --- drivers/net/hns3/hns3_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index 4ce7a2c722..dd761fcef6 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -231,14 +231,13 @@ hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args) if (value == NULL || extra_args == NULL) return 0; - val = strtoul(value, NULL, HNS3_CONVERT_TO_DECIMAL); - /* * 500ms is empirical value in process of mailbox communication. If * the delay value is set to one lower than the empirical value, mailbox * communication may fail. */ - if (val > HNS3_MBX_DEF_TIME_LIMIT_MS && val <= UINT16_MAX) + if (rte_kvargs_to_uint(value, HNS3_MBX_DEF_TIME_LIMIT_MS + 1, + UINT16_MAX, &val) == 0) *(uint16_t *)extra_args = val; return 0; -- 2.53.0