diff --git a/linux/linux/linux_eth.c b/linux/linux/linux_eth.c index e03b7762083cc9a7d6774af004f478c5609b1157..942d03d49db604bb72d76e77bee160667c76fb5b 100644 --- a/linux/linux/linux_eth.c +++ b/linux/linux/linux_eth.c @@ -217,11 +217,8 @@ static int linux_get_ethtool_stats(const char *ifname) } struct ethtool_drvinfo drvinfo = {.cmd = ETHTOOL_GDRVINFO}; - struct ifreq req = {.ifr_data = (void *)&drvinfo}; - strncpy(req.ifr_name, ifname, sizeof(req.ifr_name)); - status = ioctl(fd, SIOCETHTOOL, &req); if (status < 0) { @@ -240,7 +237,7 @@ static int linux_get_ethtool_stats(const char *ifname) } stats_size = sizeof(struct ethtool_stats) + (n_stats * sizeof(uint64_t)); - g_linux_stats = malloc(stats_size); + g_linux_stats = (struct ethtool_stats *)calloc(1, stats_size); if (!g_linux_stats) { close(fd); syslog(LOG_ERR, "%s(%d): malloc failed.",