mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: kas@informatics.muni.cz
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com,
	yoshfuji@linux-ipv6.org
Subject: Re: Patch: IPv6/AMD64: bug in net/ipv6/ndisc.c
Date: Fri, 30 Jan 2004 08:37:43 +0900 (JST)	[thread overview]
Message-ID: <20040130.083743.20740540.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <20040129221538.J24747@fi.muni.cz>

In article <20040129221538.J24747@fi.muni.cz> (at Thu, 29 Jan 2004 22:15:38 +0100), Jan Kasprzak <kas@informatics.muni.cz> says:

> while compiling the kernel (2.6.1) I have spotted the following warning:
> 
> net/ipv6/ndisc.c: In function `ndisc_router_discovery':
> net/ipv6/ndisc.c:1113: warning: comparison is always true due to limited range of data type
:

> The corresponding lines are these:
> 
>                 __u32 rtime = ntohl(ra_msg->retrans_timer);
>                                                                                 
> Here --->       if (rtime && rtime/1000 < (MAX_SCHEDULE_TIMEOUT/HZ)) {
>                         rtime = (rtime*HZ)/1000;
>                         if (rtime < HZ/10)
>                                 rtime = HZ/10;
>                         in6_dev->nd_parms->retrans_time = rtime;
>                 }
:

> The MAX_SCHEDULE_TIMEOUT is #defined to LONG_MAX in include/linux/sched.h,
> which is 2^63-1 or so on AMD64. I propose the following fix:
:

+#define MAX_SCHEDULE_TIMEOUT_32 (MAX_SCHEDULE_TIMEOUT/HZ > (1U<<31) ? \
+	(1U<<31) : MAX_SCHEDULE_TIMEOUT/HZ)

Well,... ok for now.

For long term solution, I think it is better to store timing variables 
in "unsinged long" type instead of int. 
I think there's several places to be fixed.
We'll need proc_doulongvec_jiffies(), proc_doulongvec_userhz_jiffies().

--yoshfuji

  reply	other threads:[~2004-01-29 23:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-29 21:15 Jan Kasprzak
2004-01-29 23:37 ` YOSHIFUJI Hideaki / 吉藤英明 [this message]
2004-01-29 23:39   ` David S. Miller
2004-01-30  0:40     ` Andi Kleen
2004-01-30  0:56       ` David S. Miller
2004-01-30  1:07         ` Andi Kleen

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=20040130.083743.20740540.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=kas@informatics.muni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /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

all inboxes | Powered by JetHome®