[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+fCnZe3SYq1c50hKdR3eoALz+kHE2MdUkbcbG0dhUFjaKkPNw@mail.gmail.com>
Date: Mon, 26 Sep 2022 20:07:59 +0200
From: Andrey Konovalov <andreyknvl@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: andrey.konovalov@...ux.dev, Marco Elver <elver@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux Memory Management List <linux-mm@...ck.org>,
Kees Cook <keescook@...omium.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrey Konovalov <andreyknvl@...gle.com>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH mm v2] kasan: fix array-bounds warnings in tests
On Sun, Sep 25, 2022 at 7:03 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> > --- a/mm/kasan/kasan_test.c
> > +++ b/mm/kasan/kasan_test.c
> > @@ -333,6 +333,8 @@ static void krealloc_more_oob_helper(struct kunit *test,
> > ptr2 = krealloc(ptr1, size2, GFP_KERNEL);
> > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
> >
> > + OPTIMIZER_HIDE_VAR(ptr2);
> > +
> > /* All offsets up to size2 must be accessible. */
> > ptr2[size1 - 1] = 'x';
> > ptr2[size1] = 'x';
> > @@ -365,6 +367,8 @@ static void krealloc_less_oob_helper(struct kunit *test,
> > ptr2 = krealloc(ptr1, size2, GFP_KERNEL);
> > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
> >
> > + OPTIMIZER_HIDE_VAR(ptr2);
>
> What chance does a reader have of working out why this is here? If
> "little" then a code comment would be a nice way of saving that poor
> person for having to dive into the git history.
Will add in v3. Thank you, Andrew!
Powered by blists - more mailing lists