Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4301390pxb; Mon, 25 Oct 2021 01:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGVthI8OZ0dvHbgzRSwaZBe+SzyUhuXBTPvNedj9zrTfoY8hEYOAxzOpymE2hlatbsrdTV X-Received: by 2002:a17:902:dccc:b0:140:b9a:d1e5 with SMTP id t12-20020a170902dccc00b001400b9ad1e5mr15430964pll.36.1635150011145; Mon, 25 Oct 2021 01:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635150011; cv=none; d=google.com; s=arc-20160816; b=jOpcE+G2wZmPNkGVXV7Eo8dVs4JTJ+JDA02Tww1lOTcXU4LzfdZGQHZDUYfyO1BJtf 6ySl++b9BfIpfKAttwXRCDIOFVdm/HV7ow7iZ2LMTceU6M43Nx0LdrxCfshHO2H0BmGK AK5GF2eEgyQnlkAyYyOd/H/TAuraydmdzqLAmgcDwIgGyqCD18zbZL9JBBNo8giPZUQW Qgj/yI/vS1Ob4p/v435/Je/kl3DBjTpNB7QfpLm3eEWYfJjU4w3IEgvH6KMROaCpxSez jr8HRY3d6CrEa0Bv+K7SpVhuMKGYMN8bI8ST5HUduXsMdUimq2jbxq7QCqDguzwq+r7J vnGQ== 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=PwIv4bCVI8MyJOHz1bqaWjeDoMJ0Mfwlvm7IjY+zw+Q=; b=NNcOGD5Tp9ZQo5AwsQRASz0BfTQy4Z+jITmNKGuySkXNzwugPoNKChJlkb1Ih6DGx3 SP83PU903PWU0K0C4W69cY249KYhzTa5Ff9io3Uo1kubqLl2t4bhNWXts9OiNhmx+PQi DTzAaxM1imIGPzXbrAd3a822qe3yttL92MP8QYkoIiT5reQP66nuGlZ8QGa/d5ZFGvWw xjWb+FaIHkU70dwcf2LZa9SwtLrv9jRdmhIKLB9pHk6Sy68IHi5z7LbpPDp6tVsw+uf2 RP7+A6ufOBRnZWYcOBaOH1PYjfDcwJPsuf1sgImPFVkBT7xFA7R6Y0BlnFOINE5a32KK KoLg== 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 d9si20553988pln.400.2021.10.25.01.19.56; Mon, 25 Oct 2021 01:20:11 -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 S231829AbhJYIUl (ORCPT + 99 others); Mon, 25 Oct 2021 04:20:41 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:41564 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231925AbhJYIUj (ORCPT ); Mon, 25 Oct 2021 04:20:39 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-01 (Coremail) with SMTP id qwCowACHjQkYaHZh4RxLBQ--.9442S2; Mon, 25 Oct 2021 16:17:28 +0800 (CST) From: Jiasheng Jiang To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com Cc: linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] sched: Fix implicit type conversion Date: Mon, 25 Oct 2021 08:17:27 +0000 Message-Id: <1635149847-2426546-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: qwCow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IWI evJa73UjIFyTuYvjfUeHUDDUUUU 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 'n' is defined as ULONG. However in the cpumask_next(), it is used as INT. That is vulnerable and may cause overflow. Therefore, it might be better to define 'n' as INT. Fixes: cb152ff ("sched: Fix /proc/sched_stat failure on very very large systems") Signed-off-by: Jiasheng Jiang --- kernel/sched/stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index 3f93fc3..6503d3a 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c @@ -82,7 +82,7 @@ static int show_schedstat(struct seq_file *seq, void *v) */ static void *schedstat_start(struct seq_file *file, loff_t *offset) { - unsigned long n = *offset; + int n = *offset; if (n == 0) return (void *) 1; -- 2.7.4