mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Herz <andi@geekosphere.org>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de
Subject: msecs_to_jiffies() still returns values greater then MAX_JIFFY_OFFSET
Date: Fri, 20 Apr 2012 08:51:50 +0200	[thread overview]
Message-ID: <20120420065150.GG22975@sweethome.fritz.box> (raw)

Hi,

i'm new to the LKML and so i couldn't reply to the old mail from Mar
2011.

On 29 Mar 2011 there was already a disucssion about this issue:

http://lkml.org/lkml/2011/3/29/262

The problem still exists, as /kernel/time.c wasn't patched. I stumbled
upon this "bug" when i modified the ipset sourcecode that uses
msecs_to_jiffies() for timeout calculations.

When i call msecs_to_jiffies(2147483000) the return value is 2147483000
on my x86 32-Bit System with 1000Hz. When i call the function with
msecs_to_jiffies(2147484000) the return value is MAX_JIFFY_OFFSET what's
1073741822 on my system. That isn't the behaviour i expect from this
comment in time.c:

 * - 'too large' values [that would result in larger than
 *   MAX_JIFFY_OFFSET values] mean 'infinite timeout' too.

So you can pass values greater then MAX_JIFFY_OFFSET up to INT_MAX in
this example although the limit should be at INT_MAX/2 for
MAX_JIFFY_OFFSET. 

I'm not sure if the solution is to increase MAX_JIFFY_OFFSET or to catch
values between this gap. I also don't understand why the function
returns a unsigned long but is limited to integer. It could be nice to
increase the values that can be handled with this function.

Greetings

-- 
Andreas Herz

                 reply	other threads:[~2012-04-20  7:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120420065150.GG22975@sweethome.fritz.box \
    --to=andi@geekosphere.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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®