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 BD71042B2F; Thu, 18 May 2023 00:45:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E00040E25; Thu, 18 May 2023 00:45:48 +0200 (CEST) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id 94B3040698 for ; Thu, 18 May 2023 00:45:47 +0200 (CEST) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2533ed4f1dcso1004419a91.1 for ; Wed, 17 May 2023 15:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1684363546; x=1686955546; 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=0FDabR/8IclVEB0GizLB0WoFFRjWf7CJMpbP9WMLgaY=; b=gE40C0OB8QV3SRYOuUKGrW7cLnjLjX7NO95bj2CXcm3b2ic5jl3/mS7aQvjOY4GD1a BiCVa3HxklrvQT78Ox0MHdLBCL6JJSaP3FK+S536p6yd6aSoPOppLhSLbR8Ygq+04oaK /FUXqJ2TEpmBbnBue2m+cnNIWXIJ9LkAdU4akQv6gZsk7NLeYaFJhJXTtDnPv18fSaTC E7p6hzYZ18sGS9Cp9WpxmsNwMxh3fDrN0x/DXe1+hqLSoeQzY8vw2xYF/EdN0Y8HZLvy nQi5Do33grcdqWTSnMojib1oo34Aqo3Eu8MKrCgeyOJmy2X05oY+oZi+bfjDLuKw68yz AM0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684363546; x=1686955546; 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=0FDabR/8IclVEB0GizLB0WoFFRjWf7CJMpbP9WMLgaY=; b=Y1Mo7Om6HnWYNEXP2KdQtIW/u/ZCq2M9/XvqYYPbv1def4GRjDMB+dqCGQnHjfuKBD UYtDrxA8azS9NhelSKg3gyjSlyhHobGBXG4xxrVwmasMaCkhskMeprCVPjsYBwBnLTuB utDzjOYwOPdWVJUawxxKZioNPjqWapeNa7/VUuFTcfVmL3aFzift9UTwWyED9t/r5PM8 N/n0efsBwfQZIx5zhcbW2xMmBoLSDDGjc4aJvv2tTctp8stXeBUjyH0Xm0lu2uwnOWtX kHAp6V/wE2IKYQNlWbl+HBeQypvw9FYlR4m7WJC4LPMAj961/yjfnA4/H1UFNxiiOu/8 HjZQ== X-Gm-Message-State: AC+VfDyXjTTfOMmRxNU9wIfT3KQ7u71X0hQasgxO2wspLnmNaJEI+Qnb GaiPSg3JrdijRaGqY7ZGQRqhFA== X-Google-Smtp-Source: ACHHUZ5M897M423CsY6zXkwBUexivVXwB8/gX6A2pm0fNTrkSIOiXdfnkIgNbTibfHdleaHSEuLBKg== X-Received: by 2002:a17:90a:1d4c:b0:253:45ce:fad7 with SMTP id u12-20020a17090a1d4c00b0025345cefad7mr424339pju.31.1684363546603; Wed, 17 May 2023 15:45:46 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id gb5-20020a17090b060500b002471deb13fcsm2188546pjb.6.2023.05.17.15.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 15:45:46 -0700 (PDT) Date: Wed, 17 May 2023 15:45:44 -0700 From: Stephen Hemminger To: Abdullah Sevincer Cc: dev@dpdk.org, jerinj@marvell.com, reshma.pattan@intel.com Subject: Re: [PATCH v14] app/procinfo: display eventdev xstats Message-ID: <20230517154544.55c83121@hermes.local> In-Reply-To: <20230517223724.2417630-1-abdullah.sevincer@intel.com> References: <20230320022316.2298874-1-abdullah.sevincer@intel.com> <20230517223724.2417630-1-abdullah.sevincer@intel.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, 17 May 2023 17:37:24 -0500 Abdullah Sevincer wrote: > +static int > +parse_eventdev_dump_xstats_params(char *list) > +{ > + uint8_t evdev_id; > + evdev_id = (uint8_t)atoi(list); > + > + if (evdev_id >= RTE_EVENT_MAX_DEVS) { > + printf("Invalid eventdev id, id should be between 0 - %d\n", RTE_EVENT_MAX_DEVS-1); > + return -EINVAL; > + } The cast will cause truncation of large values, so this might be a nop. If you really want to check, then something like: unsigned long evdev_id; char *endp; evdev_id = strtoul(list, &endp, 0); if (!*list || !*endp || evdev_id >= RTE_EVENT_MAX_DEVS) { fprintf(stderr, "Invalid eventdev id: %s\n", list); return -EINVAL; }