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 8ADA1A0547; Wed, 21 Apr 2021 04:33:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2B7D418C9; Wed, 21 Apr 2021 04:33:27 +0200 (CEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 18ED7418C9 for ; Wed, 21 Apr 2021 04:33:26 +0200 (CEST) Received: by mail-pg1-f172.google.com with SMTP id w10so28337501pgh.5 for ; Tue, 20 Apr 2021 19:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SWytpzC2VgQVQPRE7PhB8+wxd1UIoYfrrSEeTziB31Y=; b=LfgflaNjCvxTjzIlv+QRyE/9mV5TU10raXnvBTXzs00HDVFliru2Dp2JzCH2Wf2X3T y1Fa0UBgx3SHGq0fer6wamZHjxlgEOUIcdMvp6cVX0ImX2xH+B/EhZj0CGnR8kbVSzRd IU3VlnUsel7zXI2tFBsIzpCxOOMtC9Hp6ABV7N8WO6iod88DbwYDhNbiT2JMx8yREZhj rWlQVKPaFVUTx7yy4o4sxSFJQVdJqWg3V+o1voQHjd1TF4kcWbYE+OQf5bRXBjJs4pU6 nr/r8LZ5QSPCDXa0WjYddRePQoWoUZ5MUDiPHxFDiysBcIYz/x7RMHmum7uqOW50amtJ Cbrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SWytpzC2VgQVQPRE7PhB8+wxd1UIoYfrrSEeTziB31Y=; b=sauTOn+JGcnNKF1SEesD9RI4qDAyoZVVxF35HSeW48aL1XQ3Snb2U/rqfm3TxeWlqW f/vZQgpIBLFt6EMrUZ89QWTRGNFHQ0JVaScsbZ8dNG5Hl3ySqJ4zyHreLESgcHPXxeVK T/J3Hb78hzS492DD788i9FFITIqE0jcFwqzcorvW4Sm9i0mXlB/8dXqI7hRRRsJBpfSh VkzgY4aYF9ZdyhWM0lhbu7cozBgNRFXWA11QuWJy0KGL8M2fy/1UTfdGlRneo3zqOqZm rkBsovHVyqkkX5D2VkUQ0/lbR8a5XQ/xx3u3GGdicVmH3KjrVhDVDMgz3HuLEL73VuD/ KnXg== X-Gm-Message-State: AOAM532yf9/y3WhW4xDiP9ywz4n1NtNRxGOXDLPhn+zsu1JFBw61F04J myNhZfwU79Ff04p0M1TpW4/K/w== X-Google-Smtp-Source: ABdhPJxI3Nj67dECyl+IyMUL+MdgL0y1RrO1gP9GlxpQ/gEk9TUCRdq1fivTRTlFIJvH19Qem4NeWg== X-Received: by 2002:a17:90a:d184:: with SMTP id fu4mr8090149pjb.79.1618972405299; Tue, 20 Apr 2021 19:33:25 -0700 (PDT) Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44]) by smtp.gmail.com with ESMTPSA id c13sm309176pgw.42.2021.04.20.19.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 19:33:25 -0700 (PDT) Date: Tue, 20 Apr 2021 19:33:17 -0700 From: Stephen Hemminger To: "Min Hu (Connor)" Cc: , , , Message-ID: <20210420193317.7ffe5275@hermes.local> In-Reply-To: <1618967837-2341-3-git-send-email-humin29@huawei.com> References: <1618967837-2341-1-git-send-email-humin29@huawei.com> <1618967837-2341-3-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 2/2] eal: fix service core index validity 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 Sender: "dev" On Wed, 21 Apr 2021 09:17:17 +0800 "Min Hu (Connor)" wrote: > idx = strtoul(corelist, &end, 10); > if (errno || end == NULL) > return -1; > + if (idx < 0 || idx >= RTE_MAX_LCORE) Wondered at first how strtoul() could ever return an negative value but then noticed that idx is int here. The code that does would be clearer and safer if the variables were an unsigned type. idx, min, max should be the same type everywhere. Looks like the original code was written in old C style of "all the world's an int"