Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2259950pxb; Thu, 28 Oct 2021 20:16:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN1bIDdDYbZjCcHlxfzToqzI0/6mRrNogDfboTYKjYGHEZRzn0kmx+qfBCRIUW21E0sOFu X-Received: by 2002:a05:6402:4406:: with SMTP id y6mr11357370eda.140.1635477395304; Thu, 28 Oct 2021 20:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635477395; cv=none; d=google.com; s=arc-20160816; b=G40DVPqlo3LaJFXmNbfONZKuzau90EP99dDwCqApr+WjyxR/NlgWiDgEK0xWRLmKnh o7CifVM/2YZAwxXdZLhNywD5TESn9bZ+0FtlIbQGBaP032+XZXkiHlH6ksQrsuAvCwAB s1CwOzk9ZE4RmgqUMX9HakuRZBjQOKYagiQtMN2WvwkcwYtO46wruwBfwnEeb8N2DQoo sDZRQ+O0EA8WxVqrPkJ6kFrzZ6QyqiKFlK5sEW8yhdHCxILxq8yRgvrBa1hJHzMTR1iT vXFcqpxKqZM1d8ApmSYM+39ndwU15GgEIKYHgXsyxdGuCy1IhJ2iProm/v7aqURl6i4R E36g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Eu6639mVfNVAiOh9UeysY7gYnnoXZLqFHRniepz9QtE=; b=nQlcHdksnpvb7z94MI0vlPl9uNSka2aCl17eKaMqjvRIwaatGq2ZaJGMVb8UJS6xww nQ1wCMKPtRHP0kfXHnfkgT89DtL5tNWv74fwMIstl31mMudaN5lYdoYzMFo3Ruoqot5q tIG8iU1SQzY8AuFFXHzB3E0t0i7ewXmZO2/Tmdo+guUzDXeR2IiZaHdNWy8dQsIHLQp4 xJzYCkx3c9u1/e20HFFehyJiOTlu2TP7zR3xScJ2KUZu/Bnu93+KzpMP9RsimbSz1AeR w5yHUCuj4XBxbGdqJ2Ffecolnmr9LABHHy6uvnGLQdkKcksElwwteFbd5dLtiCmLeX4h rafA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw8si8414983ejc.645.2021.10.28.20.16.11; Thu, 28 Oct 2021 20:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbhJ2DQ5 (ORCPT + 99 others); Thu, 28 Oct 2021 23:16:57 -0400 Received: from smtp25.cstnet.cn ([159.226.251.25]:56260 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231558AbhJ2DQ4 (ORCPT ); Thu, 28 Oct 2021 23:16:56 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-05 (Coremail) with SMTP id zQCowAAX+OwBZ3thKTqVBQ--.41909S2; Fri, 29 Oct 2021 11:14:09 +0800 (CST) From: Jiasheng Jiang To: bsingharora@gmail.com Cc: linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] taskstats: Fix implicit type conversion Date: Fri, 29 Oct 2021 03:14:07 +0000 Message-Id: <1635477247-1850773-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: zQCowAAX+OwBZ3thKTqVBQ--.41909S2 X-Coremail-Antispam: 1UD129KBjvdXoWrKFy5GFyktFykZw15KFy8Krg_yoWDGFc_Ar nFqr1q93ZFyrn2q3Wxua1rtFyF93y3G3W0v34UWrsrZFyrtr43J3yqgFy5Xrn5Wr4rCFnx Zas8Jr9Ygw1xZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb48FF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVWxJr 0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK67AK6r48 MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr 0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0E wIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJV W8JwCI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3Jr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1l IxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUjHGQDUUUU U== X-Originating-IP: [124.16.138.128] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The variable 'cpu' is defined as unsigned int. However in the for_each_cpu, its values is assigned to -1. That doesn't make sense and in the cpumask_next() it is implicitly type conversed to int. It is universally accepted that the implicit type conversion is terrible. Also, having the good programming custom will set an example for others. Thus, it might be better to change the definition of 'cpu' from unsigned int to int. Signed-off-by: Jiasheng Jiang --- kernel/taskstats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 2b4898b..5d8d4e7 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -275,7 +275,7 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd) { struct listener_list *listeners; struct listener *s, *tmp, *s2; - unsigned int cpu; + int cpu; int ret = 0; if (!cpumask_subset(mask, cpu_possible_mask)) -- 2.7.4