Phil Auld
d10d1e9d9f
drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES
commit d7f06bdd6ee87fbefa05af5f57361d85e7715b11 upstream.
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>
2022-09-28 11:11:40 +02:00
..
2022-04-08 14:23:57 +02:00
2022-05-25 09:57:28 +02:00
2022-06-09 10:23:07 +02:00
2022-08-17 14:23:55 +02:00
2022-08-17 14:22:47 +02:00
2022-08-17 14:24:09 +02:00
2022-08-31 17:16:39 +02:00
2022-06-09 10:23:25 +02:00
2022-04-27 14:39:01 +02:00
2022-08-31 17:16:40 +02:00
2022-09-08 12:28:01 +02:00
2022-07-12 16:34:53 +02:00
2022-09-20 12:39:43 +02:00
2022-04-20 09:34:04 +02:00
2022-08-17 14:23:48 +02:00
2022-08-25 11:40:05 +02:00
2022-09-08 12:28:06 +02:00
2022-08-17 14:23:11 +02:00
2022-08-17 14:23:11 +02:00
2022-03-11 12:22:34 +01:00
2022-06-22 14:22:02 +02:00
2022-04-08 14:24:17 +02:00
2022-07-29 17:25:25 +02:00
2022-07-12 16:34:57 +02:00
2022-04-08 14:22:59 +02:00
2022-01-27 11:04:15 +01:00
2022-08-31 17:16:34 +02:00
2022-05-01 17:22:24 +02:00
2022-07-12 16:34:54 +02:00
2022-08-25 11:40:02 +02:00
2022-09-15 11:30:00 +02:00
2022-07-21 21:24:13 +02:00
2022-06-09 10:22:48 +02:00
2022-07-12 16:35:01 +02:00
2022-07-12 16:35:01 +02:00
2022-07-12 16:35:01 +02:00
2022-02-23 12:03:17 +01:00
2022-04-08 14:24:18 +02:00
2022-07-23 12:54:02 +02:00
2022-05-30 09:29:09 +02:00
2022-09-28 11:11:40 +02:00
2022-09-15 11:30:02 +02:00
2021-12-14 10:57:11 +01:00
2022-07-07 17:53:26 +02:00
2022-04-08 14:24:13 +02:00
2022-06-09 10:22:47 +02:00
2022-04-27 14:38:50 +02:00
2022-03-08 19:12:39 +01:00
2022-06-14 18:36:06 +02:00
2022-06-14 18:36:21 +02:00
2022-04-08 14:22:59 +02:00
2022-07-12 16:35:09 +02:00
2022-03-08 19:12:40 +01:00
2022-01-20 09:13:13 +01:00
2022-07-02 16:41:17 +02:00
2022-01-11 15:35:11 +01:00
2022-02-01 17:27:15 +01:00
2022-06-09 10:22:47 +02:00
2022-03-16 14:23:46 +01:00
2022-06-09 10:23:20 +02:00
2022-01-27 11:04:41 +01:00
2022-07-12 16:35:06 +02:00
2022-05-30 09:29:09 +02:00
2022-08-17 14:23:29 +02:00
2022-03-23 09:16:42 +01:00
2021-12-29 12:28:49 +01:00
2022-09-20 12:39:43 +02:00
2022-08-25 11:40:41 +02:00
2022-05-01 17:22:32 +02:00
2022-05-25 09:57:22 +02:00
2022-08-11 13:07:50 +02:00
2022-04-13 20:59:03 +02:00
2022-09-20 12:39:42 +02:00
2022-03-08 19:12:32 +01:00
2022-06-14 18:36:23 +02:00
2022-03-08 19:12:38 +01:00
2022-05-09 09:14:30 +02:00
2022-07-21 21:24:29 +02:00
2022-04-27 14:38:51 +02:00
2022-08-17 14:24:08 +02:00
2022-09-23 14:15:52 +02:00
2022-07-12 16:35:08 +02:00
2022-08-17 14:23:08 +02:00
2022-06-09 10:23:12 +02:00
2022-08-17 14:22:57 +02:00
2022-05-25 09:57:26 +02:00
2022-01-05 12:42:33 +01:00
2022-08-31 17:16:48 +02:00
2022-07-12 16:35:10 +02:00
2022-08-17 14:23:43 +02:00
2021-12-14 10:57:22 +01:00
2022-07-12 16:35:17 +02:00
2022-04-13 20:59:28 +02:00
2022-07-02 16:41:16 +02:00
2022-06-09 10:23:32 +02:00
2022-05-18 10:26:47 +02:00
2022-08-31 17:16:44 +02:00
2022-06-09 10:23:17 +02:00
2022-09-20 12:39:42 +02:00
2022-02-16 12:56:09 +01:00
2022-08-25 11:40:43 +02:00
2022-06-14 18:36:24 +02:00
2022-04-08 14:24:09 +02:00
2022-03-02 11:48:06 +01:00
2022-07-23 12:54:08 +02:00
2022-09-23 14:15:48 +02:00
2022-01-27 11:04:15 +01:00
2022-03-08 19:12:42 +01:00
2022-08-17 14:23:14 +02:00
2022-05-01 17:22:29 +02:00
2022-03-16 14:23:46 +01:00
2022-08-17 14:22:57 +02:00
2022-04-08 14:23:37 +02:00
2022-02-01 17:27:10 +01:00
2022-02-08 18:34:05 +01:00
2022-07-07 17:53:24 +02:00
2022-08-17 14:22:51 +02:00
2022-07-12 16:35:09 +02:00
2022-07-02 16:41:17 +02:00
2022-05-30 09:29:15 +02:00
2022-02-01 17:27:01 +01:00
2022-02-01 17:27:15 +01:00
2022-04-08 14:23:01 +02:00
2022-06-09 10:23:01 +02:00
2022-01-27 11:03:52 +01:00
2022-06-09 10:22:29 +02:00
2022-06-14 18:36:27 +02:00
2022-04-08 14:23:06 +02:00
2022-06-29 09:03:17 +02:00
2022-07-21 21:24:15 +02:00
2022-09-05 10:30:07 +02:00
2022-07-12 16:35:17 +02:00
2022-08-17 14:24:14 +02:00
2022-05-25 09:57:37 +02:00
2022-07-12 16:35:08 +02:00
2022-07-21 21:24:43 +02:00
2022-05-30 09:29:15 +02:00
2022-09-15 11:30:05 +02:00
2022-09-05 10:30:07 +02:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2022-07-12 16:35:03 +02:00
2022-05-12 12:30:05 +02:00
2022-02-16 12:56:19 +01:00
2022-04-08 14:24:17 +02:00
2022-07-29 17:25:11 +02:00
2022-07-21 21:24:35 +02:00
2022-03-02 11:47:51 +01:00
2022-05-30 09:29:13 +02:00
2022-08-17 14:23:22 +02:00
2022-08-17 14:24:28 +02:00
2022-07-29 17:25:32 +02:00
2022-08-25 11:40:34 +02:00
2022-09-15 11:30:05 +02:00
2022-05-01 17:22:33 +02:00
2022-09-08 12:28:07 +02:00
2022-04-20 09:34:13 +02:00
2022-03-16 14:23:43 +01:00
2021-12-29 12:28:43 +01:00
2022-03-16 14:23:43 +01:00
2022-07-12 16:35:01 +02:00
2022-08-17 14:23:01 +02:00
2022-03-16 14:23:44 +01:00