[igt-dev] [PATCH igt] lib: Use C99 initialisers to clear context parameters
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Wed Mar 7 15:06:37 UTC 2018
On 07/03/2018 14:40, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-03-07 14:36:34)
>>
>> On 07/03/2018 12:17, Chris Wilson wrote:
>>> valgrind complains we feed uninitialised stack into the CONTEXT_SETPARAM
>>> ioctl. It is unused by the kernel, but valgrind doesn't know that and
>>> it's easy enough to clear the struct to prevent the warning.
>>>
>>> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
>>> ---
>>> lib/igt_gt.c | 29 ++++++++++++-----------------
>>> 1 file changed, 12 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
>>> index 799ca1ae..168c5a07 100644
>>> --- a/lib/igt_gt.c
>>> +++ b/lib/igt_gt.c
>>> @@ -126,11 +126,10 @@ void igt_require_hang_ring(int fd, int ring)
>>>
>>> static unsigned context_get_ban(int fd, unsigned ctx)
>>> {
>>> - struct drm_i915_gem_context_param param;
>>> -
>>> - param.param = I915_CONTEXT_PARAM_BANNABLE;
>>> - param.value = 0;
>>> - param.size = 0;
>>> + struct drm_i915_gem_context_param param = {
>>> + .ctx_id = ctx,
>>
>> Where was this assignment before? Was it all broken as well as upsetting
>> Valgrind?
>
> It existed only in the callers imagination. Broken is an
> overstatement, since no one varied from the defaults, i.e. the caller
> has to mix in using PARAM_BANNABLE with igt_hang_ctx.
gem_reset_stats is doing that, both with default and own context. But I
don't feel like untangling this right now. Whatever it is supposed to
be, if it breaks, it was broken anyway and not a fault of this patch. so:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Regards,
Tvrtko
More information about the igt-dev
mailing list