Re: [PATCH bpf] tools, bpftool: check return value of function codegen

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

 



On 2020-06-10 at 20:50:06 +0200, Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote:
> On Wed, Jun 10, 2020 at 6:09 AM Tobias Klauser <tklauser@xxxxxxxxxx> wrote:
> >
> > The codegen function might fail an return an error. Check its return
> > value in all call sites and handle it properly.
> >
> > Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
> > ---
> 
> codegen() can fail only if the system ran out of memory or the static
> template is malformed. Both are highly unlikely. I wonder if the
> better approach would be to just exit(1) on such an unlikely error
> inside codegen() and make the function itself void-returning.
> 
> We'll probably expand codegen to other languages soon, so not having
> to do those annoying error checks everywhere is a good thing.
> 
> What do you think?

Sounds good to me, thanks. I'll send a v2 implementing your suggestion.



[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