Clarification on color parameter in drm_draw_fill24 function

Dheeraj Reddy Jonnalagadda dheeraj.linuxdev at gmail.com
Thu Dec 12 11:40:21 UTC 2024


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


More information about the dri-devel mailing list