From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: Auke Kok <auke-jan.h.kok@intel.com>, netdev@vger.kernel.org
Subject: Re: [PATCH] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ
Date: Mon, 29 Oct 2007 08:32:10 -0700 [thread overview]
Message-ID: <20071029083210.0e2c75a0@freepuppy.rosehill> (raw)
In-Reply-To: <4725B05A.9050507@garzik.org>
On Mon, 29 Oct 2007 06:05:14 -0400
Jeff Garzik <jeff@garzik.org> wrote:
> Auke Kok wrote:
> > 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;
>
> ditto comments in previous email...
Since these all use ethtool, shouldn't the checks be put into ethtool_phys_id
rather than having the driver check?
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-10-29 15:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 22:10 [PATCH] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ Auke Kok
2007-10-26 22:12 ` Stephen Hemminger
2007-10-26 22:15 ` Kok, Auke
2007-10-29 10:05 ` Jeff Garzik
2007-10-29 15:32 ` Stephen Hemminger [this message]
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=20071029083210.0e2c75a0@freepuppy.rosehill \
--to=shemminger@linux-foundation.org \
--cc=auke-jan.h.kok@intel.com \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.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