mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gerd Rausch <gerd.rausch@oracle.com>
To: Joel Granados <joel.granados@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] time/jiffies: Fix conversion breakage on systems where USER_HZ < HZ
Date: Fri, 27 Feb 2026 08:17:33 -0800	[thread overview]
Message-ID: <bbed3a0b-fd15-44ec-8362-2b88a525c3cd@oracle.com> (raw)
In-Reply-To: <png4vg76rrtjpk3k3es5knfrzelvjoebeeyaqii2lclxv5dcds@ujlxb4eg3lho>

Hi Joel,

On 2026-02-27 07:03, Joel Granados wrote:
> On Wed, Feb 25, 2026 at 03:37:49PM -0800, Gerd Rausch wrote:
>> Conversion from user_hz to jiffies broke with
>> commit 2dc164a48e6fd ("sysctl: Create converter functions with two new macros")
>>
>> because the old overflow check in do_proc_dointvec_userhz_jiffies_conv()
>> to see if "*u_ptr" was too large got replaced by an unconditional:
>>      +    if (USER_HZ < HZ)
>>      +        return -EINVAL;
>>
>> which will always be true on platforms with "USER_HZ < HZ".
>>
>> We shouldn't need this extra check anyway, because clock_t_to_jiffies()
>> returns ULONG_MAX for the overflow case:
>>      if (x >= ~0UL / (HZ / USER_HZ))
>>          return ~0UL;
>>
>> and proc_int_u2k_conv_uop() checks for "> INT_MAX" after conversion:
>>      if (u > (ulong) INT_MAX)
>>          return -EINVAL;
>>
>> Fixes: 2dc164a48e6fd ("sysctl: Create converter functions with two new macros")
>> Reported-by: Colm Harrington <colm.harrington@oracle.com>
>> Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
> I changed the message of the patch a bit. You can take a look here [1]
> 
> Best
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl.git/commit/?h=sysctl-next&id=a17a86da1c90b62866bf2f45560510f2f6f18503
> 

Looks good to me.

Thanks for adding this fix,

   Gerd


      reply	other threads:[~2026-02-27 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 23:37 Gerd Rausch
2026-02-27 14:31 ` Joel Granados
2026-02-27 16:16   ` Gerd Rausch
2026-02-27 15:03 ` Joel Granados
2026-02-27 16:17   ` Gerd Rausch [this message]

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=bbed3a0b-fd15-44ec-8362-2b88a525c3cd@oracle.com \
    --to=gerd.rausch@oracle.com \
    --cc=joel.granados@kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®