[PATCH 3/3] KVM: selftests: Delete the unused guest_snprintf()

From: Gokul K

Date: Fri Sep 18 2026 - 07:47:22 EST


guest_snprintf() is a varargs wrapper around guest_vsnprintf() that nothing
calls. Its declaration in test_util.h and its definition in
lib/guest_sprintf.c are the only two mentions anywhere under
tools/testing/selftests.

The rest of the family is alive: guest_vsnprintf() does the work and
ucall_common.c calls it, so this deletes the wrapper and nothing else.

No functional change intended.

Signed-off-by: Gokul K <gokul02k@xxxxxxxxx>
---
tools/testing/selftests/kvm/include/test_util.h | 1 -
tools/testing/selftests/kvm/lib/guest_sprintf.c | 12 ------------
2 files changed, 13 deletions(-)

diff --git a/tools/testing/selftests/kvm/include/test_util.h b/tools/testing/selftests/kvm/include/test_util.h
index a6a3e1657895..fbdf0e0c15d1 100644
--- a/tools/testing/selftests/kvm/include/test_util.h
+++ b/tools/testing/selftests/kvm/include/test_util.h
@@ -238,7 +238,6 @@ static inline u32 atoi_non_negative(const char *name, const char *num_str)
}

int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args);
-__printf(3, 4) int guest_snprintf(char *buf, int n, const char *fmt, ...);

char *strdup_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2), nonnull(1)));

diff --git a/tools/testing/selftests/kvm/lib/guest_sprintf.c b/tools/testing/selftests/kvm/lib/guest_sprintf.c
index 7a33965349a7..6caebb456f3d 100644
--- a/tools/testing/selftests/kvm/lib/guest_sprintf.c
+++ b/tools/testing/selftests/kvm/lib/guest_sprintf.c
@@ -300,15 +300,3 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args)
*str = '\0';
return str - buf;
}
-
-int guest_snprintf(char *buf, int n, const char *fmt, ...)
-{
- va_list va;
- int len;
-
- va_start(va, fmt);
- len = guest_vsnprintf(buf, n, fmt, va);
- va_end(va);
-
- return len;
-}
--
2.54.0