perf_event: Fix __dsos__write_buildid_table()
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Mon, 7 Dec 2009 04:07:15 +0000 (12:07 +0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 7 Dec 2009 05:26:24 +0000 (06:26 +0100)
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 <xiaoguangrong@cn.fujitsu.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B1C7F73.80707@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/header.c

index 08b6759287f5e7cb9429a611a880b6fbe2991302..59a9c0b3033e12352ad0754a0f3cfcb5aaeac3c5 100644 (file)
@@ -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;
        }