Re: [PATCH bpf-next v2 3/3] selftests/bpf: Add test for xdp_md context in BPF_PROG_TEST_RUN

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

 



On Thu, May 27, 2021 at 6:28 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Thu, May 27, 2021 at 1:14 PM Zvi Effron <zeffron@xxxxxxxxxxxxx> wrote:
> >
> > +
> > +       /* Data past the end of the kernel's struct xdp_md must be 0 */
> > +       bad_ctx[sizeof(bad_ctx) - 1] = 1;
> > +       tattr.ctx_in = bad_ctx;
> > +       tattr.ctx_size_in = sizeof(bad_ctx);
> > +       err = bpf_prog_test_run_opts(prog_fd, &tattr);
> > +       ASSERT_ERR(err, "bpf_prog_test_run(test2)");
> > +       ASSERT_EQ(errno, 22, "test2-errno");
>
> by the time you are checking errno it might get overwritten. If you
> want to check errno, you have to remember it right after the function
> returns

Is it sufficient to simply make the errno ASSERT the first thing after
the function returns? Or would we still need to preserve it into a
local variable?



[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