All of lore.kernel.org
 help / color / mirror / Atom feed
* Clarification on color parameter in drm_draw_fill24 function
@ 2024-12-12 11:40 Dheeraj Reddy Jonnalagadda
  2024-12-19 10:25 ` follow-up: " Dheeraj Reddy Jonnalagadda
  0 siblings, 1 reply; 2+ messages in thread
From: Dheeraj Reddy Jonnalagadda @ 2024-12-12 11:40 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann; +Cc: airlied, simona, dri-devel

Dear Maintainers,

I am writing to seek clarification regarding the implementation of the
drm_draw_fill24 function in the DRM subsystem. Specifically, Coverity has
flagged (CID 1602416) the issue in the following line in drm/drm_draw.c

--> iosys_map_wr(dmap, off + 2, u8, (color & 0x00FF0000) >> 16);

I have some questions about handling of the color parameter in the function.

The function currently accepts a u16 value as the color parameter and uses
bitwise operations to extract the RGB components. However, the mask 0x00FF0000
refers to bits 16–23, which are always zero for a u16 value. Therefore, the
expression (color & 0x00FF0000) will always result in 0.

Could you please confirm:

  1. Is the truncation of 32-bit color value to 16 bits the intended behavior?
  2. Alternatively, should the function be updated to accept 32-bit values
     as input as the function is called with 32 bit values elsewhere?

Thank you for your time. Please let me know if further information or context
is required.

-Dheeraj

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

* follow-up: Clarification on color parameter in drm_draw_fill24 function
  2024-12-12 11:40 Clarification on color parameter in drm_draw_fill24 function Dheeraj Reddy Jonnalagadda
@ 2024-12-19 10:25 ` Dheeraj Reddy Jonnalagadda
  0 siblings, 0 replies; 2+ messages in thread
From: Dheeraj Reddy Jonnalagadda @ 2024-12-19 10:25 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann; +Cc: airlied, simona, dri-devel

On Thu, Dec 12, 2024 at 05:10:21PM +0530, Dheeraj Reddy Jonnalagadda wrote:
> Dear Maintainers,
> 
> I am writing to seek clarification regarding the implementation of the
> drm_draw_fill24 function in the DRM subsystem. Specifically, Coverity has
> flagged (CID 1602416) the issue in the following line in drm/drm_draw.c
> 
> --> iosys_map_wr(dmap, off + 2, u8, (color & 0x00FF0000) >> 16);
> 
> I have some questions about handling of the color parameter in the function.
> 
> The function currently accepts a u16 value as the color parameter and uses
> bitwise operations to extract the RGB components. However, the mask 0x00FF0000
> refers to bits 16–23, which are always zero for a u16 value. Therefore, the
> expression (color & 0x00FF0000) will always result in 0.
> 
> Could you please confirm:
> 
>   1. Is the truncation of 32-bit color value to 16 bits the intended behavior?
>   2. Alternatively, should the function be updated to accept 32-bit values
>      as input as the function is called with 32 bit values elsewhere?
> 
> Thank you for your time. Please let me know if further information or context
> is required.
> 
> -Dheeraj

Dear Maintainers,

I am following up on my earlier query regarding the potential issue flagged by
Coverity (CID 1602416) in the drm_draw_fill24 function in drm/drm_draw.c.

Link to the Coverity issue:
https://scan7.scan.coverity.com/#/project-view/52348/11354?selectedIssue=1602416

The action field on Coverity has also been changed to "Fix required" for
this issue.

To summarize:

	1. The color parameter is declared as a u16, but the bitwise operation
	   (color & 0x00FF0000) targets bits that do not exist within a u16
	   range, effectively always resulting in 0.

	2. My query is whether this truncation is intentional or if the
	   function should be updated to accept a 32-bit color value, aligning
	   with its usage elsewhere.

I wanted to kindly ask if there has been any decision or additional insight
regarding this issue. If needed, I can provide a proposed patch to address the
problem once the intended behavior is clarified.

Thank you again for your time.

-Dheeraj

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

end of thread, other threads:[~2024-12-20  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 11:40 Clarification on color parameter in drm_draw_fill24 function Dheeraj Reddy Jonnalagadda
2024-12-19 10:25 ` follow-up: " Dheeraj Reddy Jonnalagadda

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.