diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-07-13 16:37:47 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-07-13 16:37:47 +0200 |
commit | dbc15575a7e0ab843931643c573404081cd3582c (patch) | |
tree | cd244db54ce413e428d9482f1cf449c933ec4e69 /trafgen.c | |
parent | f7d61b320ae3044306415d821e734d9b79477600 (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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; } |