All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] dpaa2-eth: prevent array underflow in update_cls_rule()
@ 2020-05-08 14:37 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-05-08 14:37 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: Ioana Radulescu, David S. Miller, netdev, kernel-janitors

The "location" is controlled by the user via the ethtool_set_rxnfc()
function.  This update_cls_rule() function checks for array overflows
but it doesn't check if the value is negative.  I have changed the type
to unsigned to prevent array underflows.

Fixes: afb90dbb5f78 ("dpaa2-eth: Add ethtool support for flow classification")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
index bd13ee48d6230..049afd1d6252d 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
@@ -635,7 +635,7 @@ static int num_rules(struct dpaa2_eth_priv *priv)
 
 static int update_cls_rule(struct net_device *net_dev,
 			   struct ethtool_rx_flow_spec *new_fs,
-			   int location)
+			   unsigned int location)
 {
 	struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
 	struct dpaa2_eth_cls_rule *rule;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net] dpaa2-eth: prevent array underflow in update_cls_rule()
@ 2020-05-08 14:37 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-05-08 14:37 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: Ioana Radulescu, David S. Miller, netdev, kernel-janitors

The "location" is controlled by the user via the ethtool_set_rxnfc()
function.  This update_cls_rule() function checks for array overflows
but it doesn't check if the value is negative.  I have changed the type
to unsigned to prevent array underflows.

Fixes: afb90dbb5f78 ("dpaa2-eth: Add ethtool support for flow classification")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
index bd13ee48d6230..049afd1d6252d 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
@@ -635,7 +635,7 @@ static int num_rules(struct dpaa2_eth_priv *priv)
 
 static int update_cls_rule(struct net_device *net_dev,
 			   struct ethtool_rx_flow_spec *new_fs,
-			   int location)
+			   unsigned int location)
 {
 	struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
 	struct dpaa2_eth_cls_rule *rule;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] dpaa2-eth: prevent array underflow in update_cls_rule()
  2020-05-08 14:37 ` Dan Carpenter
@ 2020-05-09  1:46   ` Jakub Kicinski
  -1 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-05-09  1:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ioana Ciornei, Ioana Radulescu, David S. Miller, netdev, kernel-janitors

On Fri, 8 May 2020 17:37:20 +0300 Dan Carpenter wrote:
> The "location" is controlled by the user via the ethtool_set_rxnfc()
> function.  This update_cls_rule() function checks for array overflows
> but it doesn't check if the value is negative.  I have changed the type
> to unsigned to prevent array underflows.
> 
> Fixes: afb90dbb5f78 ("dpaa2-eth: Add ethtool support for flow classification")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thank you!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] dpaa2-eth: prevent array underflow in update_cls_rule()
@ 2020-05-09  1:46   ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-05-09  1:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ioana Ciornei, Ioana Radulescu, David S. Miller, netdev, kernel-janitors

On Fri, 8 May 2020 17:37:20 +0300 Dan Carpenter wrote:
> The "location" is controlled by the user via the ethtool_set_rxnfc()
> function.  This update_cls_rule() function checks for array overflows
> but it doesn't check if the value is negative.  I have changed the type
> to unsigned to prevent array underflows.
> 
> Fixes: afb90dbb5f78 ("dpaa2-eth: Add ethtool support for flow classification")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thank you!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-09  1:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 14:37 [PATCH net] dpaa2-eth: prevent array underflow in update_cls_rule() Dan Carpenter
2020-05-08 14:37 ` Dan Carpenter
2020-05-09  1:46 ` Jakub Kicinski
2020-05-09  1:46   ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.