]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/selftest: Ensure string fits within name[]
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 3 Feb 2020 18:16:25 +0000 (18:16 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 4 Feb 2020 10:02:36 +0000 (10:02 +0000)
commit75291d7c02429b7f90583a340cd144b526065845
tree5ae6dbd544332b033534a08cf44b0ae9cb67ee8f
parentd83a7daec23d366f00cb414e508e503a4662123e
drm/i915/selftest: Ensure string fits within name[]

Shrink the strncpy bounds to ensure the NUL-terminator can fit within
the embedded array:

In file included from drivers/gpu/drm/i915/gem/i915_gem_context.c:2475:
drivers/gpu/drm/i915/gem/selftests/mock_context.c: In function ‘mock_context’:
drivers/gpu/drm/i915/gem/selftests/mock_context.c:40:3: error: ‘strncpy’ specified bound 24 equals destination size [-Werror=stringop-truncation]
   40 |   strncpy(ctx->name, name, sizeof(ctx->name));

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200203181625.589118-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/selftests/mock_context.c