From d9541ed3241bb6c2b805d3ea0e87563cf2a0c5c3 Mon Sep 17 00:00:00 2001 From: Xiao Guangrong Date: Mon, 7 Dec 2009 12:07:15 +0800 Subject: [PATCH] perf_event: Fix __dsos__write_buildid_table() The remain buff size is 'len - pos->long_name_len - 1', not 'len - pos->long_name_len + 1' This bug was introduced by commit 7691b1e ("perf tools: Misc small fixes"). Signed-off-by: Xiao Guangrong Acked-by: OGAWA Hirofumi Cc: Frederic Weisbecker Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Li Zefan LKML-Reference: <4B1C7F73.80707@cn.fujitsu.com> Signed-off-by: Ingo Molnar --- tools/perf/util/header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 08b6759..59a9c0b 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -209,7 +209,7 @@ static int __dsos__write_buildid_table(struct list_head *head, int fd) err = do_write(fd, pos->long_name, pos->long_name_len + 1); if (err < 0) return err; - err = do_write(fd, zero_buf, len - pos->long_name_len + 1); + err = do_write(fd, zero_buf, len - pos->long_name_len - 1); if (err < 0) return err; } -- 2.7.4