From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE93642FB8; Wed, 2 Aug 2023 18:16:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6070940DDB; Wed, 2 Aug 2023 18:16:02 +0200 (CEST) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id 53D114021D for ; Wed, 2 Aug 2023 18:16:00 +0200 (CEST) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-686efb9ee0cso6739906b3a.3 for ; Wed, 02 Aug 2023 09:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1690992959; x=1691597759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=VIX5LFnjVWuYq9Bh3WS2UURdkQMa/qGz9M5VoB9IfWI=; b=2Ts923JPXSsq5mTZ/IrPsTtBWggoPjm/4IfJjdGFUROoRJQRYfFYyHohaGXmwIy1a/ YiuCUL6ebhPScr+jyLnEyvcTDFRFyCa1ydI711+mCBB+5pnF7BNH+zTdtL0W00/pUEqk bc9PNoRaYyL8aBF0gU1ONvcqZ7yUZXFkvgPh5wUrdF7IcvkHuMgl7qp1HDF5gY7CW1CV bqc8hrvwyEFUsKd3JmE+lTuu0Lc6x8S/cZnPxBDQGzxkiQlHKRzgVSIbjNbHNTGeFE0+ IBBWpYDXWvK06E1r8vxY1iFkl4jP163uhYolSTO6wrclEUzHpXeTycTx6e/WeyGNtwqj T+gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690992959; x=1691597759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VIX5LFnjVWuYq9Bh3WS2UURdkQMa/qGz9M5VoB9IfWI=; b=kHzDyXroj3ymSBMyE+YI+DSyeU3QGw+RqzVaGxr5OHJuKWecmj6PPGUWWmm6opSYZV UjXsQ7znO9hKSjQgpibCardNMQTVRSxqkzAnjwwz6My0weHD4IjD7C+k8nlMuXFP9kaW CFqib77/DD+B9dV9J8qnR+FvkYcNotrnYczE/AQ3YJ+06DMxoK3cmsCUuizzC8aUPDju Icd2pF1JW7yOaZwV2V1SmVznDulMpzJZGiWDRRJYj4vyIeftC/IRfsrD0aDT7kqTsvtE qG027WhE9KUojf8rDkDNKowScomKt0tzSJcqUqKgqkBb2LTAXD1d4MduzhTYmjulk9El JQ9A== X-Gm-Message-State: ABy/qLZ64Yh0ZssX8ayvm/PdfRSslH/XOcTMIAGmPMycVCscupQMm7C9 hHplEuDZnt9gK06IUV4957ROSrkD3AaH9GJlyKL+Hw== X-Google-Smtp-Source: APBJJlExTVepOxA/y59c1yx6TV8R0+sUm26tMPa3KlJZQXpkuf1OE2ocBBoun3GB1FUR2JTPvIXTLQ== X-Received: by 2002:a05:6a20:2452:b0:13a:43e8:3fb5 with SMTP id t18-20020a056a20245200b0013a43e83fb5mr19733149pzc.51.1690992959416; Wed, 02 Aug 2023 09:15:59 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id u10-20020a63a90a000000b0055b44a901absm11844406pge.70.2023.08.02.09.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 09:15:59 -0700 (PDT) Date: Wed, 2 Aug 2023 09:15:57 -0700 From: Stephen Hemminger To: Wenbo Cao Cc: dev@dpdk.org, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru Subject: Re: [PATCH v2 7/8] net/rnp add devargs runtime parsing functions Message-ID: <20230802091557.369d538d@hermes.local> In-Reply-To: <20230802081106.2340406-8-caowenbo@mucse.com> References: <20230802081106.2340406-1-caowenbo@mucse.com> <20230802081106.2340406-8-caowenbo@mucse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, 2 Aug 2023 08:11:05 +0000 Wenbo Cao wrote: > + if (strcmp(key, RNP_HW_MAC_LOOPBACK_ARG) == 0) { > + uint16_t *n = extra_args; > + *n = (uint16_t)strtoul(value, NULL, 10); > + if (*n == USHRT_MAX && errno == ERANGE) > + return -1; You should be using unsigned long for n here and no cast. Otherwise a large buggy argument would not be caught. Something like: if (strcmp(key, RNP_HW_MAC_LOOPBACK_ARG) == 0) { unsigned long n; uint16_t *result = extra_args; n = strtoul(value, NULL, 10); if (n > UINT16_MAX) { XXXLOG("invalid loopback arg"... return -1; } *result = n;