mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpictl: Limit kernel sublevel to one byte
Linux stable kernels can reach greater than 256 sublevels [1], which can cause the cpi tooling to generate an invalid string that gets passed to the firmware and causes unusual responses: $ uname -r 5.4.255 $ cat /sys/firmware/cpi/system_level 0x04260000000504ff --reboot-- $ uname -r 5.4.256 $ cat /sys/firmware/cpi/system_level 0x4260000000504100 The first sublevel field is defined as one byte, so ensure that a value larger than that isn't included. [1] https://lore.kernel.org/lkml/1612534196241236@kroah.com/ Signed-off-by: Eric Farman <farman@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -246,6 +246,9 @@ get_system_level()
|
||||
read -r k_ver k_patchlvl k_sublvl k_sublvl2 <<< "$(split_kver "$kver_str" 4)"
|
||||
|
||||
# Handle excessive sublevel numbers consistently
|
||||
if [[ "$k_sublvl" -gt 255 ]] ; then
|
||||
k_sublvl=0
|
||||
fi
|
||||
if [[ "$k_sublvl2" -gt 65535 ]] ; then
|
||||
k_sublvl2=0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user