From: Auke Kok <auke-jan.h.kok@intel.com>
To: shemminger@linux-foundation.org
Cc: netdev@vger.kernel.org
Subject: [PATCH] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ
Date: Fri, 26 Oct 2007 15:10:28 -0700 [thread overview]
Message-ID: <20071026221028.1873.3005.stgit@localhost.localdomain> (raw)
Trivial replacement - use INT_MAX instead here.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Cc: shemminger@linux-foundation.org
---
drivers/net/sk98lin/skethtool.c | 4 ++--
drivers/net/skge.c | 8 ++++----
drivers/net/sky2.c | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c
index 5a6da89..4549b97 100644
--- a/drivers/net/sk98lin/skethtool.c
+++ b/drivers/net/sk98lin/skethtool.c
@@ -430,8 +430,8 @@ static int locateDevice(struct net_device *dev, u32 data)
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet->pAC;
- if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
- data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
+ if (!data)
+ data = INT_MAX;
/* start blinking */
pAC->LedsOn = 0;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b9961dc..696a79e 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -783,10 +783,10 @@ static int skge_phys_id(struct net_device *dev, u32 data)
unsigned long ms;
enum led_mode mode = LED_MODE_TST;
- if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
- ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000;
- else
- ms = data * 1000;
+ if (!data)
+ data = INT_MAX;
+
+ ms = data * HZ;
while (ms > 0) {
skge_led(skge, mode);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index c27c7d6..1381d04 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3336,10 +3336,10 @@ static int sky2_phys_id(struct net_device *dev, u32 data)
int interrupted;
int onoff = 1;
- if (!data || data > (u32) (MAX_SCHEDULE_TIMEOUT / HZ))
- ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT);
- else
- ms = data * 1000;
+ if (!data)
+ data = INT_MAX:
+
+ ms = data * HZ;
/* save initial values */
spin_lock_bh(&sky2->phy_lock);
next reply other threads:[~2007-10-26 22:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 22:10 Auke Kok [this message]
2007-10-26 22:12 ` [PATCH] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ Stephen Hemminger
2007-10-26 22:15 ` Kok, Auke
2007-10-29 10:05 ` Jeff Garzik
2007-10-29 15:32 ` Stephen Hemminger
2007-10-29 15:48 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071026221028.1873.3005.stgit@localhost.localdomain \
--to=auke-jan.h.kok@intel.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).