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 D2D8D46DD9 for ; Wed, 27 Aug 2025 18:05:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA5C940292; Wed, 27 Aug 2025 18:05:11 +0200 (CEST) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id 40F2440292 for ; Wed, 27 Aug 2025 18:05:10 +0200 (CEST) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3c4e9efb88aso3886642f8f.2 for ; Wed, 27 Aug 2025 09:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1756310710; x=1756915510; darn=dpdk.org; 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=CEYaTKka0GgDbxqKpusAkjSGfSdhE40AttuYMerJzdo=; b=0YA4vGToPzpaVZFcwRs/dr0Big76QYh55kQ6R99fwUcCjZiSZ1rH0Wz9UAaT6rJ5CK hRF5okVOoM1rGz4xYwu9g4nuaZLoeL/iqrqNSTkAvi5yeltpz1D5/8+RLdnf9aVUhDos I8m3qPRZmjxjFEegEYgShc8t10v2o/XiPKYb2gkugI/aIPdk16Fe0j/EqW/+MQqQf0RG vckB0PHZSmZgqyNRes3GGh69FscrjtQFLbRfVoQ2WbFdyUK6qaAfJWeCX9KeOn7s5QbN Tam7EgUMMfqULPgDwihoJLE4Z0zFHZqXdXJzSA6MwyD/w3W6A/kFVcQru7XOCVBsZV37 HmDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756310710; x=1756915510; 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=CEYaTKka0GgDbxqKpusAkjSGfSdhE40AttuYMerJzdo=; b=RBLaMdYHu0D//9gBDl+bFBgjR486+nYoUh0b7ygYdYtqXBkvJKbtEx1eJwFbTgHZkS uu9EjKsU5vTKKyUjK0kfJhvBrG0YlAboJwpVNvRExAcPleRiOATR+qibxjmz2YNn7E9w v0JL4L7VXZZ8BI/YhGbP2Eg7LGgTaSJgYyTqekjoalJGPXIUhfU//syHLAaeKvrJpd42 ICsFkSzIbS3/Scx6ULXEHeyXLBOQ1OXPkeAXKSHr1/AWZZLTg7yOC2q3PvFv06YLcqwL R+iDVXpdLhdTmkAtfu36b8eN84zOyI9JeqlsBeO78IOIaxD6SzOY5dgThoLyjmwMlA6L PfXw== X-Forwarded-Encrypted: i=1; AJvYcCVvMk/5YU9/LDWz0Mc+cAxi4MWf+T3kCAivoLn3qYhoEIYqOnHrWe2nQ63b3BWWtRCl+mYbl2E=@dpdk.org X-Gm-Message-State: AOJu0Yy/2hcg296/Ow1As4r6Ke95nQS6sGjkjFjLniIJ/j9rdXH2TiXR XunTf5chVN6aiF9jI6/aI/3rGd3INNKsVM+rQ55kkHk3EKrNaDrOb4Nd0GPr39anSog= X-Gm-Gg: ASbGncsOjISvC+1o3KPUSr6PKX/YsqBL01utD8yFYMnvjJ/E3iR+ifTB4SeSnBUoZ+k IqcYjPHE2RvIPMpQ57+zpue+gN4HVgkHQp5i6T4TV5zzGzIstLOlKbzsZFSwytY+kSrS+8oNyLL hrhyFXDr8wEIrs5wx03jQwdWqN6EGefNWKGLJo5qBvD06YLEHc6iuwANwRGOrzBy+SpADT/c869 lhPsCiHS4UY5lDObfdgpypAy8DUznW9fpwtDWifRBsr9dTgMCUMcwPz8r/ABOtnhSqlqo0E6fJF FqZnXkVxXqvwnXlNG6J7DFFgSyRE3Vs1Iwa0ExVtFSD/2gMlYuOSf9dr7LLfxgXI9bcBs1FaBa9 8tq0l9eTPHjZtkJPinuaNgiXhsPSSPHRYTl2aXw/gp678VrYByyCZna+wFF5pz6IgWz14iX/D5w OwV/5VuB7GcA== X-Google-Smtp-Source: AGHT+IFLvxbAIOAmPE3AR+dQqw9HEqb7rPQ33mG+5WtMXmqHvWl/FTG5ffyqDEzYoZC25B14cefSYw== X-Received: by 2002:a05:6000:2586:b0:3b7:8146:4640 with SMTP id ffacd0b85a97d-3c5de34953emr13745045f8f.56.1756310709670; Wed, 27 Aug 2025 09:05:09 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3cd0acafd09sm2443537f8f.31.2025.08.27.09.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 09:05:09 -0700 (PDT) Date: Wed, 27 Aug 2025 09:05:04 -0700 From: Stephen Hemminger To: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Cc: Cristian Dumitrescu , Aman Singh , Sunil Kumar Kori , dev@dpdk.org, stable@dpdk.org Subject: Re: [PATCH v2] app/testpmd: validate dscp and vlan table entries for meter creation Message-ID: <20250827090504.7ae3b66a@hermes.local> In-Reply-To: <20250827111837.3882892-1-14pwcse1224@uetpeshawar.edu.pk> References: <20250822121430.2228507-1-14pwcse1224@uetpeshawar.edu.pk> <20250827111837.3882892-1-14pwcse1224@uetpeshawar.edu.pk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Wed, 27 Aug 2025 07:18:37 -0400 Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> wrote: > =20 > +static int > +validate_input_color_table_entries(char *str) > +{ > + char *token =3D strtok_r(str, PARSE_DELIMITER, &str); > + for (int i =3D 0; token !=3D NULL; i++) { > + if (i > ((MAX_DSCP_TABLE_ENTRIES + MAX_VLAN_TABLE_ENTRIES) - 1)) > + return -1; > + token =3D strtok_r(str, PARSE_DELIMITER, &str); > + } > + return 0; > +} The loop doesn't look right, it is looking form next deliminator at the start of the list? Normally strtok_r is used with a different pointer as the "saveptr". =46rom man page. The strtok_r() function is a reentrant version of strtok(). T= he saveptr argument is a pointer to a char * variable that is used internally by strtok_r() i= n order to maintain con=E2=80=90 text between successive calls that parse the same string. On the first call to strtok_r(), str should point to the string to b= e parsed, and the value of *saveptr is ignored (but see VERSIONS). In subsequent calls,= str should be NULL, and saveptr (and the buffer that it points to) should be unchanged since= the previous call.