From e00bb0e984914f37da6f8f5f1f80e9f793129557 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 23 Mar 2017 15:45:51 -0700 Subject: [PATCH] ioat/kperf: replace sprintf() with snprintf() Change-Id: Ifb3170a49cc388da30a080c9e6df293bf945c81a Signed-off-by: Daniel Verkamp --- examples/ioat/kperf/ioat_kperf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ioat/kperf/ioat_kperf.c b/examples/ioat/kperf/ioat_kperf.c index 634b794f0..636ff064b 100644 --- a/examples/ioat/kperf/ioat_kperf.c +++ b/examples/ioat/kperf/ioat_kperf.c @@ -332,14 +332,14 @@ int main(int argc, char *argv[]) for (i = 0; i < threads; i++) { /* total data transfer length for the DMA channel in Bytes */ - sprintf(channel, "/sys/kernel/debug/dmaperf/dmaperf/thread_%u/copied", i); + snprintf(channel, sizeof(channel), "/sys/kernel/debug/dmaperf/dmaperf/thread_%u/copied", i); rc = get_u64_from_file(channel, &copied); if (rc < 0) { fprintf(stderr, "Cannot get channel copied data\n"); return -1; } /* time in microseconds for total data transfer length */ - sprintf(channel, "/sys/kernel/debug/dmaperf/dmaperf/thread_%u/elapsed_time", i); + snprintf(channel, sizeof(channel), "/sys/kernel/debug/dmaperf/dmaperf/thread_%u/elapsed_time", i); /* elapsed_time is in microsecond */ rc = get_u64_from_file(channel, &elapsed_time); if (rc < 0) {