Skip to content

Commit eeb71c9

Browse files
Naoya Horiguchilenb
authored andcommitted
tools/power turbostat: fix buffer overrun
turbostat could be terminated by general protection fault on some latest hardwares which (for example) support 9 levels of C-states and show 18 "tADDED" lines. That bloats the total output and finally causes buffer overrun. So let's extend the buffer to avoid this. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 605736c commit eeb71c9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/power/x86/turbostat/turbostat.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5131,7 +5131,7 @@ int initialize_counters(int cpu_id)
51315131

51325132
void allocate_output_buffer()
51335133
{
5134-
output_buffer = calloc(1, (1 + topo.num_cpus) * 1024);
5134+
output_buffer = calloc(1, (1 + topo.num_cpus) * 2048);
51355135
outp = output_buffer;
51365136
if (outp == NULL)
51375137
err(-1, "calloc output buffer");

0 commit comments

Comments
 (0)