Re: [PATCH bpf 2/2] selftests/bpf: Add negative test cases for snprintf

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

 





On 6/26/25 9:07 AM, Paul Chaignon wrote:
This patch adds a couple negative test cases with a trailing % at the
end of the format string.

Signed-off-by: Paul Chaignon <paul.chaignon@xxxxxxxxx>

LGTM with a nit below.

Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>

---
  tools/testing/selftests/bpf/prog_tests/snprintf.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/snprintf.c b/tools/testing/selftests/bpf/prog_tests/snprintf.c
index 4be6fdb78c6a..594441acb707 100644
--- a/tools/testing/selftests/bpf/prog_tests/snprintf.c
+++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c
@@ -116,6 +116,8 @@ static void test_snprintf_negative(void)
  	ASSERT_ERR(load_single_snprintf("%llc"), "invalid specifier 7");
  	ASSERT_ERR(load_single_snprintf("\x80"), "non ascii character");
  	ASSERT_ERR(load_single_snprintf("\x1"), "non printable character");
+	ASSERT_ERR(load_single_snprintf("%p%"), "invalid specifier 8");
+	ASSERT_ERR(load_single_snprintf("%s%"), "invalid specifier 9");

The above "%s%" test already succeeded without Patch 1. It would be
good to mention this in the commit message to avoid confusion.

  }
void test_snprintf(void)





[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