Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1567638

Re: [PATCH] sysctl: fix proc_doulongvec_ms_jiffies_minmax()

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] sysctl: fix proc_doulongvec_ms_jiffies_minmax()
Date 2017-01-26 19:10 +0100
Message-ID <t3WEF-2bs-9@gated-at.bofh.it> (permalink)
References <t3HYZ-1zj-1@gated-at.bofh.it> <t3WbE-1Mo-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2017-01-26 at 09:25 -0800, Linus Torvalds wrote:
> On Wed, Jan 25, 2017 at 6:20 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > We perform the conversion between kernel jiffies and ms only
> > when exporting kernel value to user space.
> >
> > We need to do the opposite operation when value is written
> > by user.
> 
> Applied. The interface is really confusing - I had to check whether
> the min/max values were in jiffies or in ms, but it looks right. It
> would probably be good to verify any overflow conditions, but we do
> check the min/max after the conversion, so overflows are at least only
> an inconvenience, not a "you can set invalid values".
> 
> The one overflow case I can imagine is trying to set some unlimited
> value, and now due to the conversion math it's not unlimited any more,
> and it just happened to work.
> 
> But the current code is clearly wrong. Of course, something might end
> up depending on it being wrong, so..

Yes, these 'convdiv' and 'convmul' names are really confusing,
especially considering we either do :

val = convmul * val / convdiv;

or

val = convdiv * (*i) / convmul;

Probably should be renamed to something like :

user_units  kernel_units

Maybe.

Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] sysctl: fix proc_doulongvec_ms_jiffies_minmax() Eric Dumazet <eric.dumazet@gmail.com> - 2017-01-26 03:30 +0100
  Re: [PATCH] sysctl: fix proc_doulongvec_ms_jiffies_minmax() Linus Torvalds <torvalds@linux-foundation.org> - 2017-01-26 18:40 +0100
    Re: [PATCH] sysctl: fix proc_doulongvec_ms_jiffies_minmax() Eric Dumazet <eric.dumazet@gmail.com> - 2017-01-26 19:10 +0100

csiph-web