From: Thomas Haller Date: Tue, 7 Aug 2018 14:01:18 +0000 (+0200) Subject: link: allocate correct number of bytes in ethtool_set_features() X-Git-Tag: v240~794 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3301f9eb97be335bf4ce05fac44bafd1c45cb10c;p=thirdparty%2Fsystemd.git link: allocate correct number of bytes in ethtool_set_features() sfeatures is a "struct ethtool_sfeatures". Use sizeof() on the correct data type. Since "struct ethtool_gstrings" is larger than "struct ethtool_sfeatures", this had no serious consequences. Fixes: 50725d10e3417fd357abe1df2f177b8458027ac7 --- diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c index 2051a9966d6..51c0cea7feb 100644 --- a/src/udev/net/ethtool-util.c +++ b/src/udev/net/ethtool-util.c @@ -320,7 +320,7 @@ int ethtool_set_features(int *fd, const char *ifname, int *features) { if (r < 0) return log_warning_errno(r, "link_config: could not get ethtool features for %s", ifname); - sfeatures = alloca0(sizeof(struct ethtool_gstrings) + DIV_ROUND_UP(strings->len, 32U) * sizeof(sfeatures->features[0])); + sfeatures = alloca0(sizeof(struct ethtool_sfeatures) + DIV_ROUND_UP(strings->len, 32U) * sizeof(sfeatures->features[0])); sfeatures->cmd = ETHTOOL_SFEATURES; sfeatures->size = DIV_ROUND_UP(strings->len, 32U);