Skip to content

Commit 0926ee9

Browse files
Naoya Horiguchigregkh
authored andcommitted
tools/power turbostat: fix buffer overrun
[ Upstream commit eeb71c9 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 94132ac commit 0926ee9

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
@@ -5125,7 +5125,7 @@ int initialize_counters(int cpu_id)
51255125

51265126
void allocate_output_buffer()
51275127
{
5128-
output_buffer = calloc(1, (1 + topo.num_cpus) * 1024);
5128+
output_buffer = calloc(1, (1 + topo.num_cpus) * 2048);
51295129
outp = output_buffer;
51305130
if (outp == NULL)
51315131
err(-1, "calloc output buffer");

0 commit comments

Comments
 (0)