bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Malaya Kumar Rout <malayarout91@gmail.com>
Cc: bpf@vger.kernel.org, andrii.nakryiko@gmail.com,
	alexei.starovoitov@gmail.com
Subject: Re: [PATCH] selftests/bpf: close the file descriptor to avoid resource leaks
Date: Tue, 15 Apr 2025 11:11:58 -0700	[thread overview]
Message-ID: <d6b24457-2217-46ec-81eb-bd0b9013d20b@linux.dev> (raw)
In-Reply-To: <20250412183847.9054-1-malayarout91@gmail.com>

On 4/12/25 11:38 AM, Malaya Kumar Rout wrote:
> diff --git a/tools/testing/selftests/bpf/prog_tests/sk_assign.c b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
> index 0b9bd1d6f7cc..05cf66265cf1 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))) {
> +		close(tc);

It is not even compiler tested.

pw-bot: cr

>   		return false;
> +	}
>   	if (strstr(tc_version, ", libbpf "))
>   		prog = "test_sk_assign_libbpf.bpf.o";
>   	else


  reply	other threads:[~2025-04-15 18:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-12 18:38 [PATCH] selftests/bpf: close the file descriptor to avoid resource leaks Malaya Kumar Rout
2025-04-15 18:11 ` Martin KaFai Lau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-21 17:44 Malaya Kumar Rout
2025-04-22 21:40 ` patchwork-bot+netdevbpf
2025-03-24  6:42 Malaya Kumar Rout
2025-04-01  6:46 ` Hou Tao
2025-04-04 15:52 ` Andrii Nakryiko
2025-04-05  5:59   ` malaya kumar rout
2025-04-07  1:36     ` Hou Tao
2025-04-07  3:40       ` malaya kumar rout

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6b24457-2217-46ec-81eb-bd0b9013d20b@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=malayarout91@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).