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 <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2089081
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Sagar Kadamati <skadamati@nvidia.com>
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Tested-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2019-04-03 12:32:30 -07:00
committed by mobile promotions
parent 3fa094c646
commit f7860833f1

View File

@@ -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)");
}
}