Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2216777pxb; Thu, 28 Oct 2021 19:08:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSjtrGa4HrjbKm0DEzrgzCYhOZBmULB7ImmT27c/XnI9Jw5YppgKTlsAeSjlQQcubFkbCB X-Received: by 2002:a05:6402:2793:: with SMTP id b19mr11103082ede.80.1635473330340; Thu, 28 Oct 2021 19:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635473330; cv=none; d=google.com; s=arc-20160816; b=ErZRoWRz+Z7SsS5Bhzq5Wzfjv9vjpYggM6z0iuVBeNct1u49aSNn+Mk74wwN7DeNC/ z7YVUL9Z/3OyO8wP5x6NTkQoLUpLcIXyZU5frT6tibTcCyEt+HZFZJ2YK1UjdqnqK2Th n6v7XnisDX3k8yX/SJBdI7FewceZKe+KJ47BDQYRO1Kp12MyPZVwBfnn91XGpgzldxX7 W49ZkFhBSTYTc2hxghmMKxfSKV0Xu4IDjpKpLp+wf/xjQ6w5B9EnGs8eb/uj+ed1S9wv v4oTqI8u0KubTlqUbxsiuBBZ1lqbsb7S1WqusIvwPtQMeuPDL6jDoCM/C6vrLOZU8ual NIDg== 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=Y+d7oy8X4Ipk4vmpmYwlaX3GXY8Qo/lQ0fzUiwbWxIk=; b=cBPyhpDLIq8jxyIbmhlF/KZ0JhNyTNOJMpJKoGJ/yVHOwZ1+ZZeB6n4/te81+24Rne OE+gVF5eD0cQHQHwvGNMzmYfIn13RaOv6LyyO38zILpCBnVvTknINRW1BPkJVUGBWnkk cdlrKQmWE6vUzvnZSY/11QojSCmt/1gTnrOVSWWsCJmfBg8ZGV5ewV7gfsZJe6VCVQ/4 ety4UH6kCOAeTPxZ10ORTpRoEG0aRN+1jct+Dbmik1LQBd03ePgiP0s2PgvxTc9Fgsj0 FEEHwg/OOc2dEuPrxOhuTcTQjVNDWPgLQuQ81jOVs1Hg1Zy+XWh7DD5QzmLNImapVMMP uqvw== 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 hq17si9065273ejc.89.2021.10.28.19.08.26; Thu, 28 Oct 2021 19:08:50 -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 S231463AbhJ2CJM (ORCPT + 99 others); Thu, 28 Oct 2021 22:09:12 -0400 Received: from smtp25.cstnet.cn ([159.226.251.25]:59566 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231348AbhJ2CJL (ORCPT ); Thu, 28 Oct 2021 22:09:11 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-05 (Coremail) with SMTP id zQCowABXGfYSV3thW+2TBQ--.15439S2; Fri, 29 Oct 2021 10:06:10 +0800 (CST) From: Jiasheng Jiang To: jeyu@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, nathan@kernel.org, ndesaulniers@google.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Jiasheng Jiang Subject: [PATCH] module: Fix implicit type conversion Date: Fri, 29 Oct 2021 02:06:09 +0000 Message-Id: <1635473169-1848729-1-git-send-email-jiasheng@iscas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VW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCT nIWIevJa73UjIFyTuYvjfUO_MaUUUUU 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_possible_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. Fixes: 10fad5e ("percpu, module: implement and use is_kernel/module_percpu_address()") Signed-off-by: Jiasheng Jiang --- kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index 927d46c..f10d611 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -632,7 +632,7 @@ static void percpu_modcopy(struct module *mod, bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr) { struct module *mod; - unsigned int cpu; + int cpu; preempt_disable(); -- 2.7.4