On Sat, Apr 12, 2025 at 11:45 AM malaya kumar rout <malayarout91@xxxxxxxxx> wrote: > > Malaya Kumar Rout > Ph. No: +91-9778203508 > +91-7008245249 > > On Thu, Apr 10, 2025 at 11:03 PM Andrii Nakryiko > <andrii.nakryiko@xxxxxxxxx> wrote: > > > > On Thu, Apr 10, 2025 at 3:38 AM Malaya Kumar Rout > > <malayarout91@xxxxxxxxx> wrote: > > > > > > Static analysis found an issue in bench_htab_mem.c > > > > > > cppcheck output before this patch: > > > tools/testing/selftests/bpf/benchs/bench_htab_mem.c:284:3: error: Resource leak: fd [resourceLeak] > > > tools/testing/selftests/bpf/prog_tests/sk_assign.c:41:3: error: Resource leak: tc [resourceLeak] > > > > > > cppcheck output after this patch: > > > No resource leaks found > > > > > > Fix the issue by closing the file descriptors fd and tc. > > > > > > Signed-off-by: Malaya Kumar Rout <malayarout91@xxxxxxxxx> > > > --- > > > > I still don't see this patch in our Patchworks. > > > > But I noticed that the subject is: > > > > RE:[PATCH RESEND bpf-next v3] selftests/bpf: close the file descriptor > > to avoid resource leaks > > > > and there is > > > > In-Reply-To: <CAADnVQJbBOK25Fx3zEG-ZH=zTFRfPNQye673b5TnpdTdMEXAUA@xxxxxxxxxxxxxx> > > > > email header, so I suspect bot ignores this because it's a reply. > > > > Please send it as a stand-alone email with `git send-email`, hopefully > > that works. > > > I have shared a stand-alone email with 'git send-email'.Kindly confirm > at your earliest convenience. If any issues arise again, please permit > me to share two separate patches, as we have modifications in two > distinct files. > Yes, this time email arrived into Patchworks, but you had pclose -> close mistake, please fix, test, and resubmit. > > > tools/testing/selftests/bpf/benchs/bench_htab_mem.c | 3 +-- > > > tools/testing/selftests/bpf/prog_tests/sk_assign.c | 4 +++- > > > 2 files changed, 4 insertions(+), 3 deletions(-) > > > > > > diff --git a/tools/testing/selftests/bpf/benchs/bench_htab_mem.c b/tools/testing/selftests/bpf/benchs/bench_htab_mem.c > > > index 926ee822143e..297e32390cd1 100644 > > > --- a/tools/testing/selftests/bpf/benchs/bench_htab_mem.c > > > +++ b/tools/testing/selftests/bpf/benchs/bench_htab_mem.c > > > @@ -279,6 +279,7 @@ static void htab_mem_read_mem_cgrp_file(const char *name, unsigned long *value) > > > } > > > > > > got = read(fd, buf, sizeof(buf) - 1); > > > + close(fd); > > > if (got <= 0) { > > > *value = 0; > > > return; > > > @@ -286,8 +287,6 @@ static void htab_mem_read_mem_cgrp_file(const char *name, unsigned long *value) > > > buf[got] = 0; > > > > > > *value = strtoull(buf, NULL, 0); > > > - > > > - close(fd); > > > } > > > > > > static void htab_mem_measure(struct bench_res *res) > > > diff --git a/tools/testing/selftests/bpf/prog_tests/sk_assign.c b/tools/testing/selftests/bpf/prog_tests/sk_assign.c > > > index 0b9bd1d6f7cc..10a0ab954b8a 100644 > > > --- a/tools/testing/selftests/bpf/prog_tests/sk_assign.c > > > +++ b/tools/testing/selftests/bpf/prog_tests/sk_assign.c > > > @@ -37,8 +37,10 @@ configure_stack(void) > > > tc = popen("tc -V", "r"); > > > if (CHECK_FAIL(!tc)) > > > return false; > > > - if (CHECK_FAIL(!fgets(tc_version, sizeof(tc_version), tc))) > > > + if (CHECK_FAIL(!fgets(tc_version, sizeof(tc_version), tc))) { > > > + pclose(tc); > > > return false; > > > + } > > > if (strstr(tc_version, ", libbpf ")) > > > prog = "test_sk_assign_libbpf.bpf.o"; > > > else > > > -- > > > 2.43.0 > > >