1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib/socket: let query_iface_speed_from_name() initialize memory passed to syscalls

I'm not sure if struct initializers would take care of padding,
so I use ZERO_STRUCT().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2020-05-07 11:06:03 +02:00
parent c83ce5f4f9
commit 4ccb581609

View File

@ -149,6 +149,7 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
strlcpy(ifr.ifr_name, name, IF_NAMESIZE);
ifr.ifr_data = (void *)&edata;
ZERO_STRUCT(edata);
edata.cmd = ETHTOOL_GLINK;
ret = ioctl(fd, SIOCETHTOOL, &ifr);
if (ret == -1) {
@ -161,6 +162,7 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
}
ifr.ifr_data = (void *)&ecmd;
ZERO_STRUCT(ecmd);
ecmd.cmd = ETHTOOL_GSET;
ret = ioctl(fd, SIOCETHTOOL, &ifr);
if (ret == -1) {