Re: [PATCH v4 bpf-next 3/7] bpf: Add helpers for trampoline image management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 24, 2023 at 7:46 AM Daniel Borkmann <daniel@xxxxxxxxxxxxx> wrote:
>
> On 10/18/23 8:03 PM, Song Liu wrote:
> [...]
> > @@ -1040,6 +1038,38 @@ arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image
> >       return -ENOTSUPP;
> >   }
> >
> > +void * __weak arch_alloc_bpf_trampoline(int size)
> > +{
> > +     void *image;
> > +
> > +     WARN_ON_ONCE(size > PAGE_SIZE || size <= 0);
>
> non-blocking / can be follow-up, but why not:
>
> if (WARN_ON_ONCE(size > PAGE_SIZE || size <= 0))
>         return NULL
>
> size could also be u32, then you don't need size <= 0 check ?

Thanks for the suggestion! The code will indeed be cleaner with
these changes.

Song





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux