From: Arun Parameswaran <aparames@broadcom.com>
To: Ben Hutchings <bwh@kernel.org>
Cc: <netdev@vger.kernel.org>, <jdzheng@broadcom.com>,
<aparames@broadcom.com>
Subject: [PATCH 1/2] ethtool: Clear the command data structure before sending requests
Date: Fri, 22 May 2015 15:43:28 -0700 [thread overview]
Message-ID: <1432334609-3971-2-git-send-email-aparames@broadcom.com> (raw)
In-Reply-To: <1432334609-3971-1-git-send-email-aparames@broadcom.com>
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 <aparames@broadcom.com>
Reviewed-by: JD (Jiandong) Zheng <jdzheng@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
next prev parent reply other threads:[~2015-05-22 22:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 22:43 [PATCH 0/2] Fix couple of issues with 'ethtool' get/set API's Arun Parameswaran
2015-05-22 22:43 ` Arun Parameswaran [this message]
2015-05-22 22:43 ` [PATCH 2/2] ethtool: Fix an issue with handling 'phyad' while updating settings Arun Parameswaran
2015-05-31 19:59 ` [PATCH 0/2] Fix couple of issues with 'ethtool' get/set API's Ben Hutchings
2015-06-01 17:14 ` Arun Parameswaran
2015-06-01 18:07 ` Ben Hutchings
2015-06-01 19:12 ` Arun Parameswaran
2015-06-01 19:29 ` Ben Hutchings
2015-06-01 21:00 ` Arun Parameswaran
2015-06-01 21:39 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432334609-3971-2-git-send-email-aparames@broadcom.com \
--to=aparames@broadcom.com \
--cc=bwh@kernel.org \
--cc=jdzheng@broadcom.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).