]> git.baikalelectronics.ru Git - kernel.git/commit
perf machine: Null-terminate version char array upon fgets(/proc/version) error
authorDonald Yandt <donald.yandt@gmail.com>
Tue, 14 May 2019 11:01:00 +0000 (07:01 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 15 May 2019 19:36:47 +0000 (16:36 -0300)
commitff6440bd636ad7852af7cb6dceaabeeaac07e179
tree646052ffc2fe8738b9b2de1b7307ce02587b99cc
parent19490aeb1a22e942cf661ecdbaedba5752cee204
perf machine: Null-terminate version char array upon fgets(/proc/version) error

If fgets() fails due to any other error besides end-of-file, the version
char array may not even be null-terminated.

Signed-off-by: Donald Yandt <donald.yandt@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Avi Kivity <avi@scylladb.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yanmin Zhang <yanmin_zhang@linux.intel.com>
Fixes: cb30dcad8c90 ("perf: 'perf kvm' tool for monitoring guest performance from host")
Link: http://lkml.kernel.org/r/20190514110100.22019-1-donald.yandt@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/machine.c