mirror of
https://github.com/samba-team/samba.git
synced 2025-09-13 17:44:21 +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:
@@ -149,6 +149,7 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
|
|||||||
strlcpy(ifr.ifr_name, name, IF_NAMESIZE);
|
strlcpy(ifr.ifr_name, name, IF_NAMESIZE);
|
||||||
|
|
||||||
ifr.ifr_data = (void *)&edata;
|
ifr.ifr_data = (void *)&edata;
|
||||||
|
ZERO_STRUCT(edata);
|
||||||
edata.cmd = ETHTOOL_GLINK;
|
edata.cmd = ETHTOOL_GLINK;
|
||||||
ret = ioctl(fd, SIOCETHTOOL, &ifr);
|
ret = ioctl(fd, SIOCETHTOOL, &ifr);
|
||||||
if (ret == -1) {
|
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;
|
ifr.ifr_data = (void *)&ecmd;
|
||||||
|
ZERO_STRUCT(ecmd);
|
||||||
ecmd.cmd = ETHTOOL_GSET;
|
ecmd.cmd = ETHTOOL_GSET;
|
||||||
ret = ioctl(fd, SIOCETHTOOL, &ifr);
|
ret = ioctl(fd, SIOCETHTOOL, &ifr);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
|
Reference in New Issue
Block a user