* [patch -mainline] niu: fix error handling in niu_class_to_ethflow()
@ 2015-02-26 16:56 Dan Carpenter
2015-02-28 17:59 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-02-26 16:56 UTC (permalink / raw)
To: David S. Miller
Cc: Benoit Taine, Fabian Frederick, Bjorn Helgaas, Eric Dumazet,
Alexander Duyck, netdev, kernel-janitors
There is a discrepancy here because the niu_class_to_ethflow() returns
zero on failure and one on success but the caller expected zero on
success and negative on failure.
The problem means that we allow the user to pass classes and flow_types
which we don't want. I've looked at it a bit and I don't see it as a
very serious bug.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 4b51f90..0c5842a 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -6989,10 +6989,10 @@ static int niu_class_to_ethflow(u64 class, int *flow_type)
*flow_type = IP_USER_FLOW;
break;
default:
- return 0;
+ return -EINVAL;
}
- return 1;
+ return 0;
}
static int niu_ethflow_to_class(int flow_type, u64 *class)
@@ -7198,11 +7198,9 @@ static int niu_get_ethtool_tcam_entry(struct niu *np,
class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >>
TCAM_V4KEY0_CLASS_CODE_SHIFT;
ret = niu_class_to_ethflow(class, &fsp->flow_type);
-
if (ret < 0) {
netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n",
parent->index);
- ret = -EINVAL;
goto out;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch -mainline] niu: fix error handling in niu_class_to_ethflow()
2015-02-26 16:56 [patch -mainline] niu: fix error handling in niu_class_to_ethflow() Dan Carpenter
@ 2015-02-28 17:59 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-28 17:59 UTC (permalink / raw)
To: dan.carpenter
Cc: benoit.taine, fabf, bhelgaas, edumazet, alexander.h.duyck, netdev,
kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 26 Feb 2015 19:56:56 +0300
> There is a discrepancy here because the niu_class_to_ethflow() returns
> zero on failure and one on success but the caller expected zero on
> success and negative on failure.
>
> The problem means that we allow the user to pass classes and flow_types
> which we don't want. I've looked at it a bit and I don't see it as a
> very serious bug.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks Dan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-28 17:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-26 16:56 [patch -mainline] niu: fix error handling in niu_class_to_ethflow() Dan Carpenter
2015-02-28 17:59 ` 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).