From f7860833f1c851add0fa4608d3dbdf0d6674f49c Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 3 Apr 2019 12:32:30 -0700 Subject: [PATCH] gpu: ngpu: POSIX log fmt string fix The os_sched unit was recently unified with QNX and as a result some new code was added to the POSIX build. This code works fine with the Tmake compiler, but on x86 local builds of the POSIX code it triggers a fmt-security warning (which is subsequently treated as an error). Thus the build breaks. The fix is to explicitly define a format of "%s" instead of passing in a format from a locally defined char array. Also fix the MISRA issues due to lack of curly braces. Change-Id: Ia5bfda39e486acde22f16e338ef0d390e5b50e3c Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/2089081 Reviewed-by: Philip Elcan Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Nicolas Benech Reviewed-by: svc-misra-checker Reviewed-by: Sagar Kadamati Reviewed-by: Thomas Fleury Tested-by: Thomas Fleury Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/posix/os_sched.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/os/posix/os_sched.c b/drivers/gpu/nvgpu/os/posix/os_sched.c index a1e62f9a1..034afb20a 100644 --- a/drivers/gpu/nvgpu/os/posix/os_sched.c +++ b/drivers/gpu/nvgpu/os/posix/os_sched.c @@ -51,8 +51,9 @@ void __nvgpu_print_current(struct gk20a *g, const char *func_name, int line, char current_tname[CURRENT_NAME_LEN]; /* pthread_getname_np() will return null terminated string on success */ - if (pthread_getname_np(0, current_tname, CURRENT_NAME_LEN) == 0) - __nvgpu_log_msg(g, func_name, line, type, current_tname); - else + if (pthread_getname_np(0, current_tname, CURRENT_NAME_LEN) == 0) { + __nvgpu_log_msg(g, func_name, line, type, "%s", current_tname); + } else { __nvgpu_log_msg(g, func_name, line, type, "(unknown process)"); + } }