summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorHaoze Xie <royenheart@gmail.com>2024-07-07 21:01:00 +0300
committerNamhyung Kim <namhyung@kernel.org>2024-07-12 19:38:40 +0300
commit6353abd32c8d2a3698115e03b71099858a38591d (patch)
tree587a684e11b2b6fd53b360d46ee7802bb26ea12e /samples
parent306f921e87fc647f1b65c9517d7c97cea854f4f3 (diff)
downloadlinux-6353abd32c8d2a3698115e03b71099858a38591d.tar.xz
perf record: Fix memset out-of-range error
Modified the object of 'memset' from '&lost.lost' to '&lost' in record__read_lost_samples. This allows 'memset' to access memory properly without causing out-of-bounds problems. The problems got from builtin-record.c are: In file included from /usr/include/string.h:495, from util/parse-events.h:13, from builtin-record.c:14: In function 'memset', inlined from 'record__read_lost_samples' at builtin-record.c:1958:6, inlined from '__cmd_record.constprop' at builtin-record.c:2817:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:10: error: '__builtin_memset' offset [17, 64] from the object at 'lost' is out of the bounds of referenced subobject 'lost' with type 'struct perf_record_lost_samples' at offset 0 [-Werror=array-bounds] 71|return __builtin___memset_chk (__dest,__ch,__len,__bos0 (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The error arised when performing a memset operation on the 'lost' variable, the bytes of 'sizeof(lost)' exceeds that of '&lost.lost', which are 64 and 16. Fixes: 6c1785cd75ef ("perf record: Ensure space for lost samples") Signed-off-by: Haoze Xie <royenheart@gmail.com> Signed-off-by: Yuan Tan <tanyuan@tinylab.org> Link: https://lore.kernel.org/r/11e12f171b846577cac698cd3999db3d7f6c4d03.1720372317.git.royenheart@gmail.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions