]> www.infradead.org Git - users/hch/misc.git/commit
drm/xe: replace format-less snprintf() with strscpy()
authorArnd Bergmann <arnd@arndb.de>
Tue, 28 May 2024 13:32:36 +0000 (15:32 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 30 May 2024 16:57:26 +0000 (18:57 +0200)
commit9bbfab1c7cf7801e50b131ccf04af8d32b01dcec
tree84aaf7c61e3dc7f1f3d5e573e961d05b77318569
parent264eecdba211bbeb8c0ed313ffe03e9dd1e20262
drm/xe: replace format-less snprintf() with strscpy()

Using snprintf() with a format string from task->comm is a bit
dangerous since the string may be controlled by unprivileged
userspace:

drivers/gpu/drm/xe/xe_devcoredump.c: In function 'devcoredump_snapshot':
drivers/gpu/drm/xe/xe_devcoredump.c:184:9: error: format not a string literal and no format arguments [-Werror=format-security]
  184 |         snprintf(ss->process_name, sizeof(ss->process_name), process_name);
      |         ^~~~~~~~

In this case there is no reason for an snprintf(), so use a simpler
string copy.

Fixes: b10d0c5e9df7 ("drm/xe: Add process name to devcoredump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240528133251.2310868-1-arnd@kernel.org
drivers/gpu/drm/xe/xe_devcoredump.c