linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sameeksha Sankpal <sameekshasankpal@gmail.com>
To: kees@kernel.org
Cc: luto@amacapital.net, wad@chromium.org, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org,
	Sameeksha Sankpal <sameekshasankpal@gmail.com>
Subject: [PATCH] [PATCH v4] selftests/seccomp: Fix indentation and rebase error logging patch
Date: Thu, 27 Nov 2025 09:01:54 +0530	[thread overview]
Message-ID: <20251127033154.12290-1-sameekshasankpal@gmail.com> (raw)

v4:
 - Resending v3 after reviewer feedback (Shuah Khan).
 - No code changes.
 - Fixes email formatting and broken threading in earlier versions.

v3:
 - Rebased against upstream seccomp tree.
 - Fixed indentation to use tabs instead of spaces.
 - Used scripts/checkpatch.pl to fix warnings.
 - Removed blank line before Signed-off-by.

v2:
 - Used TH_LOG instead of printf for error logging.
 - Moved variable declaration to the top of the function.
 - Applied review suggestions from Kees Cook.

v1:
 - Initial patch to improve error logging in get_proc_stat().

Suggested-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 61acbd45ffaa..dbd7e705a2af 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -4508,9 +4508,14 @@ static char get_proc_stat(struct __test_metadata *_metadata, pid_t pid)
 	char proc_path[100] = {0};
 	char status;
 	char *line;
+	int rc;
 
 	snprintf(proc_path, sizeof(proc_path), "/proc/%d/stat", pid);
 	ASSERT_EQ(get_nth(_metadata, proc_path, 3, &line), 1);
+	rc = get_nth(_metadata, proc_path, 3, &line);
+	ASSERT_EQ(rc, 1) {
+		TH_LOG("user_notification_fifo: failed to read stat for PID %d (rc=%d)", pid, rc);
+	}
 
 	status = *line;
 	free(line);
-- 
2.43.0


                 reply	other threads:[~2025-11-27  3:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251127033154.12290-1-sameekshasankpal@gmail.com \
    --to=sameekshasankpal@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=shuah@kernel.org \
    --cc=wad@chromium.org \
    /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).