summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2016-09-02 22:08:18 +0200
committerGitHub <noreply@github.com>2016-09-02 22:08:18 +0200
commit29272d9e03b85deafe30ff79aa291afe7cceb430 (patch)
tree20abdf09fd3d4f3d419144cd0f8e65a891274636
parent0cea2697edd26113d5328d235572e4b0c77b8779 (diff)
parenta9dee27f0d1bcbb7a8b52bfee45bc6d8ba901d17 (diff)
Merge pull request #4084 from ssahani/netfix
fix #4080
-rw-r--r--src/udev/net/ethtool-util.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c
index 19c69a98b1..b1aa0223fd 100644
--- a/src/udev/net/ethtool-util.c
+++ b/src/udev/net/ethtool-util.c
@@ -217,24 +217,28 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) {
static int ethtool_get_stringset(int *fd, struct ifreq *ifr, int stringset_id, struct ethtool_gstrings **gstrings) {
_cleanup_free_ struct ethtool_gstrings *strings = NULL;
- struct ethtool_sset_info info = {
- .cmd = ETHTOOL_GSSET_INFO,
- .reserved = 0,
- .sset_mask = 1ULL << stringset_id,
+ struct {
+ struct ethtool_sset_info info;
+ uint32_t space;
+ } buffer = {
+ .info = {
+ .cmd = ETHTOOL_GSSET_INFO,
+ .sset_mask = UINT64_C(1) << stringset_id,
+ },
};
unsigned len;
int r;
- ifr->ifr_data = (void *) &info;
+ ifr->ifr_data = (void *) &buffer.info;
r = ioctl(*fd, SIOCETHTOOL, ifr);
if (r < 0)
return -errno;
- if (!info.sset_mask)
+ if (!buffer.info.sset_mask)
return -EINVAL;
- len = info.data[0];
+ len = buffer.info.data[0];
strings = malloc0(sizeof(struct ethtool_gstrings) + len * ETH_GSTRING_LEN);
if (!strings)
@@ -271,7 +275,7 @@ int ethtool_set_features(int *fd, const char *ifname, NetDevFeature *features) {
_cleanup_free_ struct ethtool_gstrings *strings = NULL;
struct ethtool_sfeatures *sfeatures;
int block, bit, i, r;
- struct ifreq ifr;
+ struct ifreq ifr = {};
if (*fd < 0) {
r = ethtool_connect(fd);