Skip to contentSkip to conversation

ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info

PATCH New Alexander Duyck 1 participant 1 message Jul 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethtool: Resolve use of uninitialized memory in rxclass_get_dev_info

The ethtool function for getting the rule count was not zeroing out the data field before passing it to the kernel. As a result the value started uninitialized and was incorrectly returning a result indicating that devices supported setting new rule indexes. In order to correct this I am adding a one line fix that sets data to zero before we pass the command to the kernel.

---

 rxclass.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
rxclass.c +1 -0
index 4d49aa6..e1633a8 100644
@@ -207,6 +207,7 @@ static int rxclass_get_dev_info(struct cmd_context *ctx, __u32 *count,
 	int err;
 
 	nfccmd.cmd = ETHTOOL_GRXCLSRLCNT;
+	nfccmd.data = 0;
 	err = send_ioctl(ctx, &nfccmd);
 	*count = nfccmd.rule_cnt;
 	if (driver_select)