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


Groups > linux.kernel > #1734484 > unrolled thread

Re: linux-4.14-rc1/kernel/sysctl.c:2188: possible cut'n'paste error ?

Started byKees Cook <keescook@chromium.org>
First post2017-09-18 23:10 +0200
Last post2017-09-18 23:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: linux-4.14-rc1/kernel/sysctl.c:2188: possible cut'n'paste error ? Kees Cook <keescook@chromium.org> - 2017-09-18 23:10 +0200

#1734484 — Re: linux-4.14-rc1/kernel/sysctl.c:2188: possible cut'n'paste error ?

FromKees Cook <keescook@chromium.org>
Date2017-09-18 23:10 +0200
SubjectRe: linux-4.14-rc1/kernel/sysctl.c:2188: possible cut'n'paste error ?
Message-ID<urbsK-3nw-15@gated-at.bofh.it>
On Mon, Sep 18, 2017 at 1:53 PM, David Binderman <dcb314@hotmail.com> wrote:
> Hello there,
>
> linux-4.14-rc1/kernel/sysctl.c:2188] -> [linux-4.14-rc1/kernel/sysctl.c:2190]: (warning) Identical condition '*lvalp>UINT_MAX', second condition is always false
>
> Source code is
>
>         if (*lvalp > UINT_MAX)
>             return -EINVAL;
>         if (*lvalp > UINT_MAX)
>             return -EINVAL;
>
> Suggest remove second if test.

commit 4f2fec00afa6 ("sysctl: simplify unsigned int support") removed
"negp", but missed the duplication:

-static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
-                                int *valp,
-                                int write, void *data)
+static int do_proc_douintvec_conv(unsigned long *lvalp,
+                                 unsigned int *valp,
+                                 int write, void *data)
 {
        if (write) {
-               if (*negp)
+               if (*lvalp > UINT_MAX)
                        return -EINVAL;
                if (*lvalp > UINT_MAX)
                        return -EINVAL;

David, do you want to send a patch?

-Kees

-- 
Kees Cook
Pixel Security

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web