lkml.org 
[lkml]   [2021]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH mm v4 35/39] kasan: add kasan.vmalloc command line flag
On Tue, Dec 21, 2021 at 3:43 PM Alexander Potapenko <glider@google.com> wrote:
>
> >
> > + switch (kasan_arg_vmalloc) {
> > + case KASAN_ARG_VMALLOC_DEFAULT:
> > + /* Default to enabling vmalloc tagging. */
> > + fallthrough;
> > + case KASAN_ARG_VMALLOC_ON:
> > + static_branch_enable(&kasan_flag_vmalloc);
> > + break;
> > + case KASAN_ARG_VMALLOC_OFF:
> > + /* Do nothing, kasan_flag_vmalloc keeps its default value. */
> > + break;
> > + }
>
> I think we should be setting the default when defining the static key
> (e.g. in this case it should be DEFINE_STATIC_KEY_TRUE), so that:
> - the _DEFAULT case is always empty;
> - the _ON case explicitly enables the static branch
> - the _OFF case explicitly disables the branch
> This way we'll only need to change DEFINE_STATIC_KEY_TRUE to
> DEFINE_STATIC_KEY_FALSE if we want to change the default, but we don't
> have to mess up with the rest of the code.
> Right now the switch statement is confusing, because the _OFF case
> refers to some "default" value, whereas the _DEFAULT one actively
> changes the state.
>
> I see that this code is copied from kasan_flag_stacktrace
> implementation, and my comment also applies there (but I don't insist
> on fixing that one right now).

Will do in v5. Thanks!

\
 
 \ /
  Last update: 2021-12-30 20:12    [W:0.078 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site