From dbc15575a7e0ab843931643c573404081cd3582c Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Sat, 13 Jul 2013 16:37:47 +0200 Subject: trafgen: setup_shared_var: fix reamainders Commit bf9232fb6 ("trafgen: setup_shared_var: fix couple of things") forgot to amend the remaining changes in 'len' usage. So lets fix them right now. Signed-off-by: Daniel Borkmann --- trafgen.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trafgen.c b/trafgen.c index 9784366..a370333 100644 --- a/trafgen.c +++ b/trafgen.c @@ -389,9 +389,9 @@ static struct cpu_stats *setup_shared_var(unsigned long cpus) fd = open_or_die_m(file, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - write_or_die(fd, zbuff, sizeof(zbuff)); + write_or_die(fd, zbuff, len); - buff = mmap(NULL, sizeof(zbuff), PROT_READ | PROT_WRITE, + buff = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (buff == MAP_FAILED) panic("Cannot setup shared variable!\n"); @@ -399,8 +399,7 @@ static struct cpu_stats *setup_shared_var(unsigned long cpus) close(fd); unlink(file); - memset(buff, 0, sizeof(zbuff)); - + memset(buff, 0, len); return buff; } -- cgit v1.2.3-54-g00ecf