# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/msr-tools/hotfix-a-segfault.patch # Copyright (C) 2023 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- --- msr-tools-master/rdmsr.c.vanilla 2023-08-26 17:02:52.420666222 +0200 +++ msr-tools-master/rdmsr.c 2023-08-26 17:09:37.163645760 +0200 @@ -109,6 +109,10 @@ int dir_entries; dir_entries = scandir("/dev/cpu", &namelist, dir_filter, 0); + if (dir_entries < 0) { + perror("rdmsr: scandir"); + exit(1); + } while (dir_entries--) { rdmsr_on_cpu(reg, atoi(namelist[dir_entries]->d_name)); free(namelist[dir_entries]); --- msr-tools-master/wrmsr.c.vanilla 2023-08-26 17:09:46.107645307 +0200 +++ msr-tools-master/wrmsr.c 2023-08-26 17:11:22.614640428 +0200 @@ -70,6 +70,10 @@ int dir_entries; dir_entries = scandir("/dev/cpu", &namelist, dir_filter, 0); + if (dir_entries < 0) { + perror("wrmsr: scandir"); + exit(1); + } while (dir_entries--) { wrmsr_on_cpu(reg, atoi(namelist[dir_entries]->d_name), valcnt, regvals);