* [Intel-gfx] [PATCH] drm/i915/selftest: Ensure string fits within name[]
@ 2020-02-03 18:16 Chris Wilson
2020-02-04 10:00 ` Mika Kuoppala
2020-02-04 19:39 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2020-02-03 18:16 UTC (permalink / raw)
To: intel-gfx
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>
---
drivers/gpu/drm/i915/gem/selftests/mock_context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.c b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
index 7bad8fed4238..81764289cf0d 100644
--- a/drivers/gpu/drm/i915/gem/selftests/mock_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
@@ -37,7 +37,7 @@ mock_context(struct drm_i915_private *i915,
if (name) {
struct i915_ppgtt *ppgtt;
- strncpy(ctx->name, name, sizeof(ctx->name));
+ strncpy(ctx->name, name, sizeof(ctx->name) - 1);
ppgtt = mock_ppgtt(i915, name);
if (!ppgtt)
--
2.25.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915/selftest: Ensure string fits within name[]
2020-02-03 18:16 [Intel-gfx] [PATCH] drm/i915/selftest: Ensure string fits within name[] Chris Wilson
@ 2020-02-04 10:00 ` Mika Kuoppala
2020-02-04 19:39 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Mika Kuoppala @ 2020-02-04 10:00 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
Chris Wilson <chris@chris-wilson.co.uk> writes:
> 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>
> ---
> drivers/gpu/drm/i915/gem/selftests/mock_context.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.c b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> index 7bad8fed4238..81764289cf0d 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> @@ -37,7 +37,7 @@ mock_context(struct drm_i915_private *i915,
> if (name) {
> struct i915_ppgtt *ppgtt;
>
> - strncpy(ctx->name, name, sizeof(ctx->name));
> + strncpy(ctx->name, name, sizeof(ctx->name) - 1);
>
> ppgtt = mock_ppgtt(i915, name);
> if (!ppgtt)
> --
> 2.25.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/selftest: Ensure string fits within name[]
2020-02-03 18:16 [Intel-gfx] [PATCH] drm/i915/selftest: Ensure string fits within name[] Chris Wilson
2020-02-04 10:00 ` Mika Kuoppala
@ 2020-02-04 19:39 ` Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2020-02-04 19:39 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/selftest: Ensure string fits within name[]
URL : https://patchwork.freedesktop.org/series/72936/
State : failure
== Summary ==
Applying: drm/i915/selftest: Ensure string fits within name[]
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gem/selftests/mock_context.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-04 19:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 18:16 [Intel-gfx] [PATCH] drm/i915/selftest: Ensure string fits within name[] Chris Wilson
2020-02-04 10:00 ` Mika Kuoppala
2020-02-04 19:39 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.