summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cdrom_id/cdrom_id.c2
-rw-r--r--src/libudev/hashmap.c2
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-list.c2
-rw-r--r--src/libudev/libudev-monitor.c10
-rw-r--r--src/scsi_id/scsi_serial.c16
-rw-r--r--src/udev/udev-builtin-input_id.c2
-rw-r--r--src/udev/udev-ctrl.c2
-rw-r--r--src/udev/udev-event.c7
-rw-r--r--src/udev/udev-rules.c6
-rw-r--r--src/udev/udevadm-monitor.c4
-rw-r--r--src/udev/udevd.c16
12 files changed, 36 insertions, 35 deletions
diff --git a/src/cdrom_id/cdrom_id.c b/src/cdrom_id/cdrom_id.c
index 5b98ff35bd..c2c904c0a8 100644
--- a/src/cdrom_id/cdrom_id.c
+++ b/src/cdrom_id/cdrom_id.c
@@ -159,7 +159,7 @@ struct scsi_cmd {
static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd)
{
- memset(cmd, 0x00, sizeof(struct scsi_cmd));
+ memzero(cmd, sizeof(struct scsi_cmd));
cmd->cgc.quiet = 1;
cmd->cgc.sense = &cmd->_sense.s;
cmd->sg_io.interface_id = 'S';
diff --git a/src/libudev/hashmap.c b/src/libudev/hashmap.c
index 23e42f7b34..b92c83202e 100644
--- a/src/libudev/hashmap.c
+++ b/src/libudev/hashmap.c
@@ -168,7 +168,7 @@ Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
if (!h)
return NULL;
- memset(h, 0, size);
+ memzero(h, size);
} else {
h = malloc0(size);
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 06fadf6341..38144e3fbe 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -810,7 +810,7 @@ _public_ struct udev_device *udev_device_new_from_device_id(struct udev *udev, c
sk = socket(PF_INET, SOCK_DGRAM, 0);
if (sk < 0)
return NULL;
- memset(&ifr, 0x00, sizeof(struct ifreq));
+ memzero(&ifr, sizeof(struct ifreq));
ifr.ifr_ifindex = ifindex;
if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) {
close(sk);
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c
index 1cf53b074f..c6e5a61fe9 100644
--- a/src/libudev/libudev-list.c
+++ b/src/libudev/libudev-list.c
@@ -95,7 +95,7 @@ static inline struct udev_list_entry *list_node_to_entry(struct udev_list_node *
void udev_list_init(struct udev *udev, struct udev_list *list, bool unique)
{
- memset(list, 0x00, sizeof(struct udev_list));
+ memzero(list, sizeof(struct udev_list));
list->udev = udev;
list->unique = unique;
udev_list_node_init(&list->node);
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index fa20a69e85..bd22741c66 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -291,7 +291,7 @@ _public_ int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL)
return 0;
- memset(ins, 0x00, sizeof(ins));
+ memzero(ins, sizeof(ins));
i = 0;
/* load magic in A */
@@ -371,7 +371,7 @@ _public_ int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff);
/* install filter */
- memset(&filter, 0x00, sizeof(filter));
+ memzero(&filter, sizeof(filter));
filter.len = i;
filter.filter = ins;
err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
@@ -599,7 +599,7 @@ retry:
return NULL;
iov.iov_base = &buf;
iov.iov_len = sizeof(buf);
- memset (&smsg, 0x00, sizeof(struct msghdr));
+ memzero(&smsg, sizeof(struct msghdr));
smsg.msg_iov = &iov;
smsg.msg_iovlen = 1;
smsg.msg_control = cred_msg;
@@ -744,7 +744,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
return -EINVAL;
/* add versioned header */
- memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header));
+ memzero(&nlh, sizeof(struct udev_monitor_netlink_header));
memcpy(nlh.prefix, "libudev", 8);
nlh.magic = htonl(UDEV_MONITOR_MAGIC);
nlh.header_size = sizeof(struct udev_monitor_netlink_header);
@@ -771,7 +771,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
iov[1].iov_base = (char *)buf;
iov[1].iov_len = blen;
- memset(&smsg, 0x00, sizeof(struct msghdr));
+ memzero(&smsg, sizeof(struct msghdr));
smsg.msg_iov = iov;
smsg.msg_iovlen = 2;
/*
diff --git a/src/scsi_id/scsi_serial.c b/src/scsi_id/scsi_serial.c
index 66e752e426..2f2afcee6e 100644
--- a/src/scsi_id/scsi_serial.c
+++ b/src/scsi_id/scsi_serial.c
@@ -331,7 +331,7 @@ static int scsi_inquiry(struct udev *udev,
resend:
if (dev_scsi->use_sg == 4) {
- memset(&io_v4, 0, sizeof(struct sg_io_v4));
+ memzero(&io_v4, sizeof(struct sg_io_v4));
io_v4.guard = 'Q';
io_v4.protocol = BSG_PROTOCOL_SCSI;
io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
@@ -343,7 +343,7 @@ resend:
io_v4.din_xferp = (uintptr_t)buf;
io_buf = (void *)&io_v4;
} else {
- memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
+ memzero(&io_hdr, sizeof(struct sg_io_hdr));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof(inq_cmd);
io_hdr.mx_sb_len = sizeof(sense);
@@ -410,7 +410,7 @@ static int do_scsi_page0_inquiry(struct udev *udev,
{
int retval;
- memset(buffer, 0, len);
+ memzero(buffer, len);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len);
if (retval < 0)
return 1;
@@ -622,7 +622,7 @@ static int do_scsi_page83_inquiry(struct udev *udev,
/* also pick up the page 80 serial number */
do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN);
- memset(page_83, 0, SCSI_INQ_BUFF_LEN);
+ memzero(page_83, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83,
SCSI_INQ_BUFF_LEN);
if (retval < 0)
@@ -709,7 +709,7 @@ static int do_scsi_page83_prespc3_inquiry(struct udev *udev,
int i, j;
unsigned char page_83[SCSI_INQ_BUFF_LEN];
- memset(page_83, 0, SCSI_INQ_BUFF_LEN);
+ memzero(page_83, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN);
if (retval < 0)
return 1;
@@ -773,7 +773,7 @@ static int do_scsi_page80_inquiry(struct udev *udev,
int len;
unsigned char buf[SCSI_INQ_BUFF_LEN];
- memset(buf, 0, SCSI_INQ_BUFF_LEN);
+ memzero(buf, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN);
if (retval < 0)
return retval;
@@ -832,7 +832,7 @@ int scsi_std_inquiry(struct udev *udev,
sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev),
minor(statbuf.st_rdev));
- memset(buf, 0, SCSI_INQ_BUFF_LEN);
+ memzero(buf, SCSI_INQ_BUFF_LEN);
err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN);
if (err < 0)
goto out;
@@ -861,7 +861,7 @@ int scsi_get_serial(struct udev *udev,
int ind;
int retval;
- memset(dev_scsi->serial, 0, len);
+ memzero(dev_scsi->serial, len);
srand((unsigned int)getpid());
for (cnt = 20; cnt > 0; cnt--) {
struct timespec duration;
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index 4691fc073d..9b99d1ff9f 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -59,7 +59,7 @@ static void get_cap_mask(struct udev_device *dev,
snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr));
log_debug("%s raw kernel attribute: %s", attr, text);
- memset (bitmask, 0, bitmask_size);
+ memzero(bitmask, bitmask_size);
i = 0;
while ((word = strrchr(text, ' ')) != NULL) {
val = strtoul (word+1, NULL, 16);
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 6d4dc6543b..2d315ea77f 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -268,7 +268,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int
struct udev_ctrl_msg_wire ctrl_msg_wire;
int err = 0;
- memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire));
+ memzero(&ctrl_msg_wire, sizeof(struct udev_ctrl_msg_wire));
strcpy(ctrl_msg_wire.version, "udev-" VERSION);
ctrl_msg_wire.magic = UDEV_CTRL_MAGIC;
ctrl_msg_wire.type = type;
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index d4a54faf13..01d579b455 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -441,7 +441,7 @@ static void spawn_read(struct udev_event *event,
}
if (fd_stdout >= 0) {
- memset(&ep_outpipe, 0, sizeof(struct epoll_event));
+ memzero(&ep_outpipe, sizeof(struct epoll_event));
ep_outpipe.events = EPOLLIN;
ep_outpipe.data.ptr = &fd_stdout;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) {
@@ -451,7 +451,7 @@ static void spawn_read(struct udev_event *event,
}
if (fd_stderr >= 0) {
- memset(&ep_errpipe, 0, sizeof(struct epoll_event));
+ memzero(&ep_errpipe, sizeof(struct epoll_event));
ep_errpipe.events = EPOLLIN;
ep_errpipe.data.ptr = &fd_stderr;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) {
@@ -774,7 +774,8 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
return err;
}
- memset(&ifr, 0x00, sizeof(struct ifreq));
+ memzero(&ifr, sizeof(struct ifreq));
+
strscpy(ifr.ifr_name, IFNAMSIZ, oldname);
strscpy(ifr.ifr_newname, IFNAMSIZ, newname);
err = ioctl(sk, SIOCSIFNAME, &ifr);
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index d129b0f3a0..e5a15aa934 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -875,7 +875,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
struct token *token = &rule_tmp->token[rule_tmp->token_cur];
const char *attr = NULL;
- memset(token, 0x00, sizeof(struct token));
+ memzero(token, sizeof(struct token));
switch (type) {
case TK_M_ACTION:
@@ -1057,7 +1057,7 @@ static int add_rule(struct udev_rules *rules, char *line,
const char *attr;
struct rule_tmp rule_tmp;
- memset(&rule_tmp, 0x00, sizeof(struct rule_tmp));
+ memzero(&rule_tmp, sizeof(struct rule_tmp));
rule_tmp.rules = rules;
rule_tmp.rule.type = TK_RULE;
/* the offset in the rule is limited to unsigned short */
@@ -1657,7 +1657,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
strv_free(files);
- memset(&end_token, 0x00, sizeof(struct token));
+ memzero(&end_token, sizeof(struct token));
end_token.type = TK_END;
add_token(rules, &end_token);
log_debug("rules contain %zu bytes tokens (%u * %zu bytes), %zu bytes strings",
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index 6022e8db82..b2f7f6ba4c 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -194,7 +194,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[])
return 2;
}
- memset(&ep_udev, 0, sizeof(struct epoll_event));
+ memzero(&ep_udev, sizeof(struct epoll_event));
ep_udev.events = EPOLLIN;
ep_udev.data.fd = fd_udev;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) {
@@ -228,7 +228,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[])
return 4;
}
- memset(&ep_kernel, 0, sizeof(struct epoll_event));
+ memzero(&ep_kernel, sizeof(struct epoll_event));
ep_kernel.events = EPOLLIN;
ep_kernel.data.fd = fd_kernel;
if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) {
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 224763eaa5..ae2067cddf 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -247,12 +247,12 @@ static void worker_new(struct event *event)
goto out;
}
- memset(&ep_signal, 0, sizeof(struct epoll_event));
+ memzero(&ep_signal, sizeof(struct epoll_event));
ep_signal.events = EPOLLIN;
ep_signal.data.fd = fd_signal;
fd_monitor = udev_monitor_get_fd(worker_monitor);
- memset(&ep_monitor, 0, sizeof(struct epoll_event));
+ memzero(&ep_monitor, sizeof(struct epoll_event));
ep_monitor.events = EPOLLIN;
ep_monitor.data.fd = fd_monitor;
@@ -303,7 +303,7 @@ static void worker_new(struct event *event)
udev_monitor_send_device(worker_monitor, NULL, dev);
/* send udevd the result of the event execution */
- memset(&msg, 0, sizeof(struct worker_message));
+ memzero(&msg, sizeof(struct worker_message));
if (err != 0)
msg.exitcode = err;
msg.pid = getpid();
@@ -1183,23 +1183,23 @@ int main(int argc, char *argv[])
goto exit;
}
- memset(&ep_ctrl, 0, sizeof(struct epoll_event));
+ memzero(&ep_ctrl, sizeof(struct epoll_event));
ep_ctrl.events = EPOLLIN;
ep_ctrl.data.fd = fd_ctrl;
- memset(&ep_inotify, 0, sizeof(struct epoll_event));
+ memzero(&ep_inotify, sizeof(struct epoll_event));
ep_inotify.events = EPOLLIN;
ep_inotify.data.fd = fd_inotify;
- memset(&ep_signal, 0, sizeof(struct epoll_event));
+ memzero(&ep_signal, sizeof(struct epoll_event));
ep_signal.events = EPOLLIN;
ep_signal.data.fd = fd_signal;
- memset(&ep_netlink, 0, sizeof(struct epoll_event));
+ memzero(&ep_netlink, sizeof(struct epoll_event));
ep_netlink.events = EPOLLIN;
ep_netlink.data.fd = fd_netlink;
- memset(&ep_worker, 0, sizeof(struct epoll_event));
+ memzero(&ep_worker, sizeof(struct epoll_event));
ep_worker.events = EPOLLIN;
ep_worker.data.fd = fd_worker;