summaryrefslogtreecommitdiff
path: root/trafgen.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-07-13 16:37:47 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-07-13 16:37:47 +0200
commitdbc15575a7e0ab843931643c573404081cd3582c (patch)
treecd244db54ce413e428d9482f1cf449c933ec4e69 /trafgen.c
parentf7d61b320ae3044306415d821e734d9b79477600 (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'trafgen.c')
-rw-r--r--trafgen.c7
1 files 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;
}