Re: [PATCH v2 14/19] lib/stackdepot, kasan: add flags to __stack_depot_save and rename

Andrey Konovalov
2023-09-15T23:43:36Z

On Fri, Sep 15, 2023 at 10:32 PM Marco Elver <elver@google.com> wrote:
> > +depot_stack_handle_t stack_depot_save_flags(unsigned long *entries,
> > + unsigned int nr_entries,
> > + gfp_t alloc_flags,
> > + depot_flags_t depot_flags)
> > {
> > struct list_head *bucket;
> > struct stack_record *found = NULL;
> > depot_stack_handle_t handle = 0;
> > struct page *page = NULL;
> > void *prealloc = NULL;
> > + bool can_alloc = depot_flags & STACK_DEPOT_FLAG_CAN_ALLOC;
> > bool need_alloc = false;
> > unsigned long flags;
> > u32 hash;
> >
> > + if (depot_flags & ~STACK_DEPOT_FLAGS_MASK)
> > + return 0;
> > +
>
> Shouldn't this be a WARN due to invalid flags?

Good idea! Will fix. Thanks!