https://github.com/torvalds/linux
Revision d7f06bdd6ee87fbefa05af5f57361d85e7715b11 authored by Phil Auld on 06 September 2022, 20:35:42 UTC, committed by Greg Kroah-Hartman on 22 September 2022, 11:13:12 UTC
As PAGE_SIZE is unsigned long, -1 > PAGE_SIZE when NR_CPUS <= 3.
This leads to very large file sizes:

topology$ ls -l
total 0
-r--r--r-- 1 root root 18446744073709551615 Sep  5 11:59 core_cpus
-r--r--r-- 1 root root                 4096 Sep  5 11:59 core_cpus_list
-r--r--r-- 1 root root                 4096 Sep  5 10:58 core_id
-r--r--r-- 1 root root 18446744073709551615 Sep  5 10:10 core_siblings
-r--r--r-- 1 root root                 4096 Sep  5 11:59 core_siblings_list
-r--r--r-- 1 root root 18446744073709551615 Sep  5 11:59 die_cpus
-r--r--r-- 1 root root                 4096 Sep  5 11:59 die_cpus_list
-r--r--r-- 1 root root                 4096 Sep  5 11:59 die_id
-r--r--r-- 1 root root 18446744073709551615 Sep  5 11:59 package_cpus
-r--r--r-- 1 root root                 4096 Sep  5 11:59 package_cpus_list
-r--r--r-- 1 root root                 4096 Sep  5 10:58 physical_package_id
-r--r--r-- 1 root root 18446744073709551615 Sep  5 10:10 thread_siblings
-r--r--r-- 1 root root                 4096 Sep  5 11:59 thread_siblings_list

Adjust the inequality to catch the case when NR_CPUS is configured
to a small value.

Fixes: 7ee951acd31a ("drivers/base: fix userspace break from using bin_attributes for cpumap and cpulist")
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Yury Norov <yury.norov@gmail.com>
Cc: stable@vger.kernel.org
Cc: feng xiangjun <fengxj325@gmail.com>
Reported-by: feng xiangjun <fengxj325@gmail.com>
Signed-off-by: Phil Auld <pauld@redhat.com>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Link: https://lore.kernel.org/r/20220906203542.1796629-1-pauld@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d8ab468
History
Tip revision: d7f06bdd6ee87fbefa05af5f57361d85e7715b11 authored by Phil Auld on 06 September 2022, 20:35:42 UTC
drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES
Tip revision: d7f06bd
File Mode Size
Kconfig -rw-r--r-- 5.8 KB
Makefile -rw-r--r-- 986 bytes
alarmtimer.c -rw-r--r-- 23.7 KB
clockevents.c -rw-r--r-- 19.5 KB
clocksource-wdtest.c -rw-r--r-- 5.8 KB
clocksource.c -rw-r--r-- 41.3 KB
hrtimer.c -rw-r--r-- 66.1 KB
itimer.c -rw-r--r-- 10.2 KB
jiffies.c -rw-r--r-- 2.6 KB
namespace.c -rw-r--r-- 10.4 KB
ntp.c -rw-r--r-- 28.3 KB
ntp_internal.h -rw-r--r-- 783 bytes
posix-clock.c -rw-r--r-- 5.6 KB
posix-cpu-timers.c -rw-r--r-- 44.6 KB
posix-stubs.c -rw-r--r-- 5.5 KB
posix-timers.c -rw-r--r-- 37.4 KB
posix-timers.h -rw-r--r-- 1.9 KB
sched_clock.c -rw-r--r-- 7.7 KB
test_udelay.c -rw-r--r-- 3.6 KB
tick-broadcast-hrtimer.c -rw-r--r-- 3.2 KB
tick-broadcast.c -rw-r--r-- 30.3 KB
tick-common.c -rw-r--r-- 14.7 KB
tick-internal.h -rw-r--r-- 7.9 KB
tick-legacy.c -rw-r--r-- 999 bytes
tick-oneshot.c -rw-r--r-- 3.2 KB
tick-sched.c -rw-r--r-- 39.6 KB
tick-sched.h -rw-r--r-- 3.5 KB
time.c -rw-r--r-- 22.8 KB
time_test.c -rw-r--r-- 2.0 KB
timeconst.bc -rw-r--r-- 3.0 KB
timeconv.c -rw-r--r-- 4.5 KB
timecounter.c -rw-r--r-- 2.5 KB
timekeeping.c -rw-r--r-- 71.1 KB
timekeeping.h -rw-r--r-- 983 bytes
timekeeping_debug.c -rw-r--r-- 1.3 KB
timekeeping_internal.h -rw-r--r-- 921 bytes
timer.c -rw-r--r-- 61.5 KB
timer_list.c -rw-r--r-- 8.6 KB
vsyscall.c -rw-r--r-- 4.9 KB

back to top