Re: [PATCH bpf-next v3 18/18] selftests/bpf: Test attaching bpf qdisc to mq and non root

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

 



On Mon, Feb 3, 2025 at 9:58 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>
> On Fri, 2025-01-31 at 11:28 -0800, Amery Hung wrote:
>
> [...]
>
> > diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_qdisc.c b/tools/testing/selftests/bpf/prog_tests/bpf_qdisc.c
> > index 7e8e3170e6b6..f3158170edff 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/bpf_qdisc.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/bpf_qdisc.c
> > @@ -86,18 +86,125 @@ static void test_fq(void)
> >       bpf_qdisc_fq__destroy(fq_skel);
> >  }
> >
> > +static int netdevsim_write_cmd(const char *path, const char *cmd)
> > +{
> > +     FILE *fp;
> > +
> > +     fp = fopen(path, "w");
> > +     if (!ASSERT_OK_PTR(fp, "write_netdevsim_cmd"))
> > +             return -errno;
> > +
> > +     fprintf(fp, cmd);
>
> I get the following error message when compiling these tests using
> clang 19.1.7:
>
> <kernel>/tools/testing/selftests/bpf/prog_tests/bpf_qdisc.c:97:14: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
>    97 |         fprintf(fp, cmd);
>       |                     ^~~
> <kernel>/tools/testing/selftests/bpf/prog_tests/bpf_qdisc.c:97:14: note: treat the string as an argument to avoid this
>    97 |         fprintf(fp, cmd);
>       |                     ^
>       |
>

I am removing the use of netdevsim and along with this function in the
next version. The warning should also disappear. Thanks for the
review!

> > +     fclose(fp);
> > +     return 0;
> > +}
> > +
>
> [...]
>





[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