* [PATCH] net: dsa: mv88e6xxx: hwtstamp: remove unnecessary range checking tests
@ 2018-02-16 17:47 Gustavo A. R. Silva
2018-02-19 16:12 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-16 17:47 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Richard Cochran
Cc: netdev, linux-kernel, Gustavo A. R. Silva
_port_ is already known to be a valid index in the callers [1]. So
these checks are unnecessary.
[1] https://lkml.org/lkml/2018/2/16/469
Addresses-Coverity-ID: 1465287
Addresses-Coverity-ID: 1465291
Suggested-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/net/dsa/mv88e6xxx/hwtstamp.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/hwtstamp.c b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
index b251d53..c6d6a35 100644
--- a/drivers/net/dsa/mv88e6xxx/hwtstamp.c
+++ b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
@@ -179,9 +179,6 @@ int mv88e6xxx_port_hwtstamp_set(struct dsa_switch *ds, int port,
if (!chip->info->ptp_support)
return -EOPNOTSUPP;
- if (port < 0 || port >= mv88e6xxx_num_ports(chip))
- return -EINVAL;
-
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
return -EFAULT;
@@ -206,9 +203,6 @@ int mv88e6xxx_port_hwtstamp_get(struct dsa_switch *ds, int port,
if (!chip->info->ptp_support)
return -EOPNOTSUPP;
- if (port < 0 || port >= mv88e6xxx_num_ports(chip))
- return -EINVAL;
-
return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
-EFAULT : 0;
}
@@ -255,9 +249,6 @@ static u8 *mv88e6xxx_should_tstamp(struct mv88e6xxx_chip *chip, int port,
if (!chip->info->ptp_support)
return NULL;
- if (port < 0 || port >= mv88e6xxx_num_ports(chip))
- return NULL;
-
hdr = parse_ptp_header(skb, type);
if (!hdr)
return NULL;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: dsa: mv88e6xxx: hwtstamp: remove unnecessary range checking tests
2018-02-16 17:47 [PATCH] net: dsa: mv88e6xxx: hwtstamp: remove unnecessary range checking tests Gustavo A. R. Silva
@ 2018-02-19 16:12 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-19 16:12 UTC (permalink / raw)
To: gustavo
Cc: andrew, vivien.didelot, f.fainelli, richardcochran, netdev,
linux-kernel, garsilva
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Fri, 16 Feb 2018 11:47:39 -0600
> _port_ is already known to be a valid index in the callers [1]. So
> these checks are unnecessary.
>
> [1] https://lkml.org/lkml/2018/2/16/469
>
> Addresses-Coverity-ID: 1465287
> Addresses-Coverity-ID: 1465291
> Suggested-by: Richard Cochran <richardcochran@gmail.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-19 16:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-16 17:47 [PATCH] net: dsa: mv88e6xxx: hwtstamp: remove unnecessary range checking tests Gustavo A. R. Silva
2018-02-19 16:12 ` 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).