* [PATCH net] gianfar: Fix overflow check and return value for gfar_get_cls_all()
@ 2011-09-06 22:44 Ben Hutchings
2011-09-20 19:40 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2011-09-06 22:44 UTC (permalink / raw)
To: David Miller, Sebastian Poehn; +Cc: netdev
This function may currently fill one entry beyond the end of the
array it is given. It also doesn't return an error code in case
it does detect overflow.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This code is new for 3.1, so no stable update required.
Not tested in any way, as this driver depends on FSL_SOC.
Ben.
drivers/net/gianfar_ethtool.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 25a8c2a..0caf3c3 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -1669,10 +1669,10 @@ static int gfar_get_cls_all(struct gfar_private *priv,
u32 i = 0;
list_for_each_entry(comp, &priv->rx_list.list, list) {
- if (i <= cmd->rule_cnt) {
- rule_locs[i] = comp->fs.location;
- i++;
- }
+ if (i == cmd->rule_cnt)
+ return -EMSGSIZE;
+ rule_locs[i] = comp->fs.location;
+ i++;
}
cmd->data = MAX_FILER_IDX;
--
1.7.4.4
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] gianfar: Fix overflow check and return value for gfar_get_cls_all()
2011-09-06 22:44 [PATCH net] gianfar: Fix overflow check and return value for gfar_get_cls_all() Ben Hutchings
@ 2011-09-20 19:40 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-09-20 19:40 UTC (permalink / raw)
To: bhutchings; +Cc: sebastian.poehn, netdev
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 06 Sep 2011 23:44:25 +0100
> This function may currently fill one entry beyond the end of the
> array it is given. It also doesn't return an error code in case
> it does detect overflow.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Applied, thanks a lot Ben.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-20 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-06 22:44 [PATCH net] gianfar: Fix overflow check and return value for gfar_get_cls_all() Ben Hutchings
2011-09-20 19:40 ` David Miller
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).