mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* re: drm/i915: Use the i915_device name for identifying our, request fences
@ 2019-12-12 19:53 Colin Ian King
  2019-12-12 20:38 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Ian King @ 2019-12-12 19:53 UTC (permalink / raw)
  To: Chris Wilson
  Cc: Venkata Sandeep Dhanalakota, intel-gfx, dri-devel, linux-kernel

Hi,

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

commit 65c29dbb19b2451990c5c477fef7ada3b8218f05
Author: Chris Wilson <chris@chris-wilson.co.uk>
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* re: drm/i915: Use the i915_device name for identifying our, request fences
  2019-12-12 19:53 drm/i915: Use the i915_device name for identifying our, request fences Colin Ian King
@ 2019-12-12 20:38 ` Chris Wilson
  2019-12-12 20:58   ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2019-12-12 20:38 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Venkata Sandeep Dhanalakota, intel-gfx, dri-devel, linux-kernel

Quoting Colin Ian King (2019-12-12 19:53:33)
> Hi,
> 
> Static analysis with Coverity has picked up an issue with the following
> commit:
> 
> commit 65c29dbb19b2451990c5c477fef7ada3b8218f05
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> 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?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: drm/i915: Use the i915_device name for identifying our, request fences
  2019-12-12 20:38 ` Chris Wilson
@ 2019-12-12 20:58   ` Colin Ian King
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2019-12-12 20:58 UTC (permalink / raw)
  To: Chris Wilson
  Cc: Venkata Sandeep Dhanalakota, intel-gfx, dri-devel, linux-kernel

On 12/12/2019 20:38, Chris Wilson wrote:
> Quoting Colin Ian King (2019-12-12 19:53:33)
>> Hi,
>>
>> Static analysis with Coverity has picked up an issue with the following
>> commit:
>>
>> commit 65c29dbb19b2451990c5c477fef7ada3b8218f05
>> Author: Chris Wilson <chris@chris-wilson.co.uk>
>> 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?
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-12 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12 19:53 drm/i915: Use the i915_device name for identifying our, request fences Colin Ian King
2019-12-12 20:38 ` Chris Wilson
2019-12-12 20:58   ` Colin Ian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®