Skip to contentSkip to conversation

drm/i915: Use the i915_device name for identifying our, request fences

DISCUSSION Colin Ian King 2 participants 3 messages Dec 12, 2019

lore
Share & tools
lore
#0 lore raw

Hi,

Static analysis with Coverity has picked up an issue with the following commit:

commit 65c29dbb19b2451990c5c477fef7ada3b8218f05

Author: Chris Wilson <[email protected]>
Date:   Wed Dec 11 15:02:04 2019 +0000

drm/i915: Use the i915_device name for identifying our request fences

In source drivers/gpu/drm/i915/i915_request.c and function i915_fence_get_timeline_name there is the following:

	return to_request(fence)->gem_context->name ?: "[" DRIVER_NAME "]";

However name is an array: char name[TASK_COMM_LEN + 8], so it can never be null, so the ternary operator will always return name and will never reaturn "[" DRIVER_NAME "]". Should it instead be checking if name[0] is '\0' instead?

Colin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

Quoting Colin Ian King (2019-12-12 19:53:33)

Quoted 14 lines

Hi,

Static analysis with Coverity has picked up an issue with the following commit:

commit 65c29dbb19b2451990c5c477fef7ada3b8218f05

Author: Chris Wilson <[email protected]>
Date:   Wed Dec 11 15:02:04 2019 +0000

drm/i915: Use the i915_device name for identifying our request fences

In source drivers/gpu/drm/i915/i915_request.c and function i915_fence_get_timeline_name there is the following:

Quoted 6 lines
        return to_request(fence)->gem_context->name ?: "[" DRIVER_NAME "]";

However name is an array: char name[TASK_COMM_LEN + 8], so it can never be null, so the ternary operator will always return name and will never reaturn "[" DRIVER_NAME "]". Should it instead be checking if name[0] is '\0' instead?

It's older than that patch, we made it a char[] some time ago. There's a patch pending to make it conditional on ce->gem_context instead. -Chris

#2 lore raw
Quoted 17 lines · Chris Wilson

Quoting Colin Ian King (2019-12-12 19:53:33)

Quoted 16 lines

Hi,

Static analysis with Coverity has picked up an issue with the following commit:

commit 65c29dbb19b2451990c5c477fef7ada3b8218f05

Author: Chris Wilson <[email protected]>
Date:   Wed Dec 11 15:02:04 2019 +0000

drm/i915: Use the i915_device name for identifying our request fences

In source drivers/gpu/drm/i915/i915_request.c and function i915_fence_get_timeline_name there is the following:

        return to_request(fence)->gem_context->name ?: "[" DRIVER_NAME "]";
Quoted 9 lines
Quoted 4 lines

However name is an array: char name[TASK_COMM_LEN + 8], so it can never be null, so the ternary operator will always return name and will never reaturn "[" DRIVER_NAME "]". Should it instead be checking if name[0] is '\0' instead?

It's older than that patch, we made it a char[] some time ago. There's a patch pending to make it conditional on ce->gem_context instead. -Chris

Ah, thanks for looking into that.

Colin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel