diff options
author | Michael Young <m.a.young@durham.ac.uk> | 2013-02-13 17:00:15 +0000 |
---|---|---|
committer | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2013-02-28 11:48:29 +0000 |
commit | bdce365321497ed92e03e8a8e57f481740849eef (patch) | |
tree | 57f3bf416d39e012c21fafb79b05d89393c0ee40 | |
parent | 1f0ffb6d2deeb5c4f0744527da542dc6e46772cd (diff) | |
download | xen-bdce365321497ed92e03e8a8e57f481740849eef.tar.gz xen-bdce365321497ed92e03e8a8e57f481740849eef.tar.bz2 xen-bdce365321497ed92e03e8a8e57f481740849eef.zip |
tools: Fix memset(&p,0,sizeof(p)) idiom in several places.
gcc 4.8 identifies several places where code of the form memset(x, 0,
sizeof(x)); is used incorrectly, meaning that less memory is set to
zero than required.
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Committed-by: Keir Fraser <keir@xen.org>
(cherry picked from commit d119301b5816b39b5ba722a2f8b301b37e8e34bd)
-rw-r--r-- | tools/blktap2/drivers/md5.c | 2 | ||||
-rw-r--r-- | tools/debugger/kdd/kdd-xen.c | 2 | ||||
-rw-r--r-- | tools/libxc/xc_dom_boot.c | 2 | ||||
-rw-r--r-- | tools/python/xen/lowlevel/netlink/libnetlink.c | 2 | ||||
-rw-r--r-- | tools/xenstat/libxenstat/src/xenstat_linux.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/tools/blktap2/drivers/md5.c b/tools/blktap2/drivers/md5.c index 27a360eba1..e765832479 100644 --- a/tools/blktap2/drivers/md5.c +++ b/tools/blktap2/drivers/md5.c @@ -174,7 +174,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) MD5Transform(ctx->buf, (uint32_t *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ diff --git a/tools/debugger/kdd/kdd-xen.c b/tools/debugger/kdd/kdd-xen.c index b2488c8ecf..4fbea7df73 100644 --- a/tools/debugger/kdd/kdd-xen.c +++ b/tools/debugger/kdd/kdd-xen.c @@ -333,7 +333,7 @@ int kdd_get_regs(kdd_guest *g, int cpuid, kdd_regs *r, int w64) if (!cpu) return -1; - memset(r, 0, sizeof(r)); + memset(r, 0, sizeof(*r)); if (w64) kdd_get_regs_x86_64(cpu, &r->r64); diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index 65f60df32f..9a5b245c4f 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -265,7 +265,7 @@ int xc_dom_boot_image(struct xc_dom_image *dom) return rc; /* let the vm run */ - memset(ctxt, 0, sizeof(ctxt)); + memset(ctxt, 0, sizeof(*ctxt)); if ( (rc = dom->arch_hooks->vcpu(dom, ctxt)) != 0 ) return rc; xc_dom_unmap_all(dom); diff --git a/tools/python/xen/lowlevel/netlink/libnetlink.c b/tools/python/xen/lowlevel/netlink/libnetlink.c index 75e4a51600..c5fc0bf46b 100644 --- a/tools/python/xen/lowlevel/netlink/libnetlink.c +++ b/tools/python/xen/lowlevel/netlink/libnetlink.c @@ -37,7 +37,7 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions, int sndbuf = 32768; int rcvbuf = 32768; - memset(rth, 0, sizeof(rth)); + memset(rth, 0, sizeof(*rth)); rth->fd = socket(AF_NETLINK, SOCK_RAW, protocol); if (rth->fd < 0) { diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c index 1543fb21de..931b24e154 100644 --- a/tools/xenstat/libxenstat/src/xenstat_linux.c +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c @@ -113,7 +113,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign /* Initialize all variables called has passed as non-NULL to zeros */ if (iface != NULL) - memset(iface, 0, sizeof(iface)); + memset(iface, 0, sizeof(*iface)); if (rxBytes != NULL) *rxBytes = 0; if (rxPackets != NULL) |