Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1490120 > unrolled thread

[PATCH] cxgb4: fix -ve error check on a signed iq

Started byColin King <colin.king@canonical.com>
First post2016-09-23 15:50 +0200
Last post2016-09-24 14:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] cxgb4: fix -ve error check on a signed iq Colin King <colin.king@canonical.com> - 2016-09-23 15:50 +0200
    Re: [PATCH] cxgb4: fix -ve error check on a signed iq David Miller <davem@davemloft.net> - 2016-09-24 14:40 +0200

#1490120 — [PATCH] cxgb4: fix -ve error check on a signed iq

FromColin King <colin.king@canonical.com>
Date2016-09-23 15:50 +0200
Subject[PATCH] cxgb4: fix -ve error check on a signed iq
Message-ID<skz1w-4hK-57@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

iq is unsigned, so the error check for iq < 0 has no effect so errors
can slip past this check.  Fix this by making iq signed and also
get_filter_steerq return a signed int so a -ve error can be returned.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
index 2a61617..9c3644d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
@@ -117,11 +117,11 @@ static int validate_filter(struct net_device *dev,
 	return 0;
 }
 
-static unsigned int get_filter_steerq(struct net_device *dev,
+static int get_filter_steerq(struct net_device *dev,
 				      struct ch_filter_specification *fs)
 {
 	struct adapter *adapter = netdev2adap(dev);
-	unsigned int iq;
+	int iq;
 
 	/* If the user has requested steering matching Ingress Packets
 	 * to a specific Queue Set, we need to make sure it's in range
@@ -443,10 +443,10 @@ int __cxgb4_set_filter(struct net_device *dev, int filter_id,
 		       struct filter_ctx *ctx)
 {
 	struct adapter *adapter = netdev2adap(dev);
-	unsigned int max_fidx, fidx, iq;
+	unsigned int max_fidx, fidx;
 	struct filter_entry *f;
 	u32 iconf;
-	int ret;
+	int iq, ret;
 
 	max_fidx = adapter->tids.nftids;
 	if (filter_id != (max_fidx + adapter->tids.nsftids - 1) &&
-- 
2.9.3

[toc] | [next] | [standalone]


#1490641

FromDavid Miller <davem@davemloft.net>
Date2016-09-24 14:40 +0200
Message-ID<skUpj-Yr-9@gated-at.bofh.it>
In reply to#1490120
From: Colin King <colin.king@canonical.com>
Date: Fri, 23 Sep 2016 14:45:13 +0100

> -static unsigned int get_filter_steerq(struct net_device *dev,
> +static int get_filter_steerq(struct net_device *dev,
>  				      struct ch_filter_specification *fs)

If you change the location of the openning parenthesis of the first
line, you must reindent the second line so that the arguments are
placed preciely at the column following that openning parenthesis.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web