lkml.org 
[lkml]   [2022]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH mm v2] kasan: fix array-bounds warnings in tests
On Sun, Sep 25, 2022 at 7:03 PM Andrew Morton <akpm@linux-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!

\
 
 \ /
  Last update: 2022-09-26 20:18    [W:0.043 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site