]> git.baikalelectronics.ru Git - kernel.git/commit
cpumask: Omit terminating null byte in cpumap_print_{list,bitmask}_to_buf
authorTobias Klauser <tklauser@distanz.ch>
Thu, 16 Sep 2021 22:27:05 +0000 (00:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Sep 2021 15:34:53 +0000 (17:34 +0200)
commitc41196aacd85a729f39a9d5a07a6ff95ebf7d001
treeb5e8bfbd9790d02b6ba4aa731c96ee4331903aba
parentb3899d096a1786163167d155079f0b0b3f6e85d1
cpumask: Omit terminating null byte in cpumap_print_{list,bitmask}_to_buf

The changes in the patch series [1] introduced a terminating null byte
when reading from cpulist or cpumap sysfs files, for example:

  $ xxd /sys/devices/system/node/node0/cpulist
  00000000: 302d 310a 00                             0-1..

Before this change, the output looked as follows:

  $ xxd /sys/devices/system/node/node0/cpulist
  00000000: 302d 310a                                0-1.

Fix this regression by excluding the terminating null byte from the
returned length in cpumap_print_list_to_buf and
cpumap_print_bitmask_to_buf.

[1] https://lore.kernel.org/all/20210806110251.560-1-song.bao.hua@hisilicon.com/

Fixes: 4654a45d1895 ("cpumask: introduce cpumap_print_list/bitmask_to_buf to support large bitmask and list")
Acked-by: Barry Song <song.bao.hua@hisilicon.com>
Acked-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Link: https://lore.kernel.org/r/20210916222705.13554-1-tklauser@distanz.ch
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/cpumask.h