diff options
| author | Hungyu Lin <dennylin0707@gmail.com> | 2026-10-20 17:01:26 +0000 |
|---|---|---|
| committer | Yury Norov <ynorov@nvidia.com> | 2026-10-28 11:21:39 -0400 |
| commit | 4c9c30534d06fea3070e57b868f8b7755950824c (patch) | |
| tree | 9f3d10be24cda8e32da87d10b3ad83d8f2bacb71 /scripts/Makefile.thinlto | |
| parent | 3e02ace831695cd0162e45ae6bfa946927d1075f (diff) | |
| download | linux-next-4c9c30534d06fea3070e57b868f8b7755950824c.tar.gz linux-next-4c9c30534d06fea3070e57b868f8b7755950824c.zip | |
cpumask: Preserve short reads in cpumap printing helpers
The cpumap printing helpers unconditionally subtract one from the bitmap
helper's return value to exclude a terminating NUL. A partial read may
not reach that NUL, so this also subtracts a data byte from the returned
length. A one-byte read therefore returns zero even when data remains.
For example, this command prints nothing despite the file being nonempty:
head -c 1 /sys/devices/system/cpu/cpu0/topology/core_cpus_list
Subtract one only when the copied range actually ends in NUL. This
preserves short reads, EOF and negative error returns while continuing
to exclude the terminator from complete sysfs reads.
Fixes: c86a2d9058c5 ("cpumask: Omit terminating null byte in cpumap_print_{list,bitmask}_to_buf")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Yury Norov <ynorov@nvidia.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
