The 'ethtool' is not clearing the command data structure in the do_gset() & do_sset() API's while sending commands to get/set parametres. This used to work since the Kernel clears the data structure (which was a bug and is being fixed).
This patch adds a 'memset' to the do_gset() & do_sset() to clear the command data structure. This will prevent the 'ethtool' from passing wrong parametres, for example incorrect 'phyad'. Signed-off-by: Arun Parameswaran <apara...@broadcom.com> Reviewed-by: JD (Jiandong) Zheng <jdzh...@broadcom.com> --- ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ethtool.c b/ethtool.c index 01b13a6..668c189 100644 --- a/ethtool.c +++ b/ethtool.c @@ -2275,6 +2275,7 @@ static int do_gset(struct cmd_context *ctx) fprintf(stdout, "Settings for %s:\n", ctx->devname); + memset(&ecmd, 0, sizeof(struct ethtool_cmd)); ecmd.cmd = ETHTOOL_GSET; err = send_ioctl(ctx, &ecmd); if (err == 0) { @@ -2520,6 +2521,8 @@ static int do_sset(struct cmd_context *ctx) if (gset_changed) { struct ethtool_cmd ecmd; + memset(&ecmd, 0, sizeof(struct ethtool_cmd)); + ecmd.cmd = ETHTOOL_GSET; err = send_ioctl(ctx, &ecmd); if (err < 0) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html