diff options
author | Greg KH <gregkh@linuxfoundation.org> | 2014-01-31 06:51:32 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-01-31 11:55:01 +0100 |
commit | 29804cc1e0f37ee34301530fd7f1eb8550be464e (patch) | |
tree | ba287b984b216279bb342579a9d1039383ca3a39 /src/libsystemd/sd-bus/bus-message.c | |
parent | b5cfa7408c4cb68e9bb232fc34b07fd03c915617 (diff) |
use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set). So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
Diffstat (limited to 'src/libsystemd/sd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 4e95226c5d..323413406a 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -194,7 +194,7 @@ static void *message_extend_fields(sd_bus_message *m, size_t align, size_t sz, b /* Zero out padding */ if (start > old_size) - memset((uint8_t*) np + old_size, 0, start - old_size); + memzero((uint8_t*) np + old_size, start - old_size); op = m->header; m->header = np; @@ -252,7 +252,7 @@ static int message_append_field_string( return -ENOMEM; p[0] = h; - memset(p+1, 0, 7); + memzero(p+1, 7); memcpy(p+8, s, l); p[8+l] = 0; p[8+l+1] = 0; @@ -337,7 +337,7 @@ static int message_append_field_uint32(sd_bus_message *m, uint8_t h, uint32_t x) return -ENOMEM; p[0] = h; - memset(p+1, 0, 7); + memzero(p+1, 7); *((uint32_t*) (p + 8)) = x; p[12] = 0; p[13] = 'u'; @@ -1228,7 +1228,7 @@ static void *message_extend_body(sd_bus_message *m, size_t align, size_t sz, boo return NULL; if (padding > 0) { - memset(p, 0, padding); + memzero(p, padding); p = (uint8_t*) p + padding; } @@ -2514,7 +2514,7 @@ _public_ int sd_bus_message_append_array_iovec( if (iov[i].iov_base) memcpy(p, iov[i].iov_base, iov[i].iov_len); else - memset(p, 0, iov[i].iov_len); + memzero(p, iov[i].iov_len); p = (uint8_t*) p + iov[i].iov_len; } @@ -2779,7 +2779,7 @@ int bus_message_seal(sd_bus_message *m, uint64_t cookie, usec_t timeout) { l = BUS_MESSAGE_FIELDS_SIZE(m); a = ALIGN8(l) - l; if (a > 0) - memset((uint8_t*) BUS_MESSAGE_FIELDS(m) + l, 0, a); + memzero((uint8_t*) BUS_MESSAGE_FIELDS(m) + l, a); /* If this is something we can send as memfd, then let's seal the memfd now. Note that we can send memfds as payload only |