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 9D40B42495; Thu, 26 Jan 2023 18:03:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8054D40143; Thu, 26 Jan 2023 18:03:35 +0100 (CET) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 25577400D7 for ; Thu, 26 Jan 2023 18:03:34 +0100 (CET) Received: by mail-pf1-f173.google.com with SMTP id g9so1509613pfo.5 for ; Thu, 26 Jan 2023 09:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; 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=/OX+2YZFKIf6PbLXzxlOxZLX+LzuIqAro+R0vAsWrKk=; b=OnvMV0bsi4zthZoZhWu3r2XO7sMbaGSzYa+72Gskl3pj9zJSNqhfIEl5ZRiZaVQNnf DvdDsiMmk+6khopnw7wBzqchSuKEUHli227kX/jku5mPoH6B0/AtERYDX+7GGN4i9i46 uWc4EBh+59Y/85T35FuAeihoa1Ck2dvBP3FBOKaTzsbqTsqJBel61VWVE1OLFnXU6FCA 7deGoYTsKPlMruLgQn0LoIbhfXH4D/9GgcmKC6KPDuq4h5jSA4rLjLpqADxD+cBY5m70 2RdkULZd3QX2/ohUlVKO/mn9uJ27ZXkUp/gG0+14vDqINqbxDpuoHFYWZGj36nh9QwIw jIXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=/OX+2YZFKIf6PbLXzxlOxZLX+LzuIqAro+R0vAsWrKk=; b=otpv27lodMt/bznnB+eAFoWElO5EV2yagsTfYJBJu8hxQu72me96IJzW+Q2vzou080 UjPbFxm2hKs+Oda1KBu86cEEIAXRi5JeEiznUvtSgG3fcNrwJDeGHQ63xOrY1K2l9Xsm dLRkL4PDlSAhNF24ZLgtUkvIuI1qixz4U+cS93FfDL5/VtxgQOX6dAHyBvGdM6bG/QSf CHTq1ETmIUN6DR2OtY8iW7tFTWh6HGWlteJ3BYvr8hAyIlrrVAvsURvuKlr9CLPKAOTe ymsEu8KCqyKthU4ZjsaP6Tlkn37b6x+p8yWVH/iaCWFj6g18szcwDBt0vnZ9mF70o3wI U3Dg== X-Gm-Message-State: AFqh2kq3xRPANLEiqGqnMXyToWFeB4HdTtzIb7A3y/VQgP9rkh0z3gn8 zvhe/upVRvR1OirqDcimobC24w== X-Google-Smtp-Source: AMrXdXt/vZyS8WsKwGlNjuEfU28OrG+oo3C3EaqqZ737kTyqiJunFJeAjnUPQF8APn60kzl5EQLkyw== X-Received: by 2002:a05:6a00:1755:b0:58d:ae6e:836d with SMTP id j21-20020a056a00175500b0058dae6e836dmr34669711pfc.33.1674752613124; Thu, 26 Jan 2023 09:03:33 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id t22-20020a056a0021d600b0058d9e915891sm1082340pfj.57.2023.01.26.09.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 09:03:32 -0800 (PST) Date: Thu, 26 Jan 2023 09:03:30 -0800 From: Stephen Hemminger To: Robin Jarry Cc: dev@dpdk.org, Morten =?UTF-8?B?QnLDuHJ1cA==?= , Kevin Laatz Subject: Re: [PATCH v7 1/5] eal: add lcore info in telemetry Message-ID: <20230126090330.13014fbf@hermes.local> In-Reply-To: <20230126152045.1036904-2-rjarry@redhat.com> References: <20230126152045.1036904-1-rjarry@redhat.com> <20230126152045.1036904-2-rjarry@redhat.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 Thu, 26 Jan 2023 16:20:41 +0100 Robin Jarry wrote: > + struct lcore_telemetry_info info = { .d = d }; > + char *endptr = NULL; > + > + if (params == NULL || strlen(params) == 0) > + return -EINVAL; > + errno = 0; > + info.lcore_id = strtoul(params, &endptr, 10); > + if (errno) > + return -errno; > + if (endptr == params) > + return -EINVAL; Alternatively, you could should check for lcore out of range. Simplified as: struct lcore_telemetry_info info = { .d = d }; char *endptr; // init not really needed if (params == NULL) // length check can be handled later return -EINVAL; info.lcore_id = strtoul(params, &endptr, 10); if (*params == '\0' || *endptr != '\0 || info.lcore_id >= RTE_MAX_LCORE) return -EINVAL; ;