drm: panel: Add driver for Himax HX8279 DDIC panels

Colin King (gmail) colin.i.king at gmail.com
Tue Apr 22 21:41:20 UTC 2025


Hi,

static analysis on today's linux-next has found two issues with the 
following commit:

commit 38d42c261389985e8dd4739dbd97e2dc855e8dd0
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
Date:   Mon Apr 14 10:29:18 2025 +0200

     drm: panel: Add driver for Himax HX8279 DDIC panels


In the following code, boolean variables goa_odd_valid and 
goa_even_valid are not initialized. They are only being set (to false) 
on the num_zero if statements:

static int hx8279_check_goa_config(struct hx8279 *hx, struct device *dev)
{
         const struct hx8279_panel_desc *desc = hx->desc;
         bool goa_odd_valid, goa_even_valid;
         int i, num_zero, num_clr = 0;

         /* Up to 4 zero values is a valid configuration. Check them all. */
         num_zero = 1;
         for (i = 0; i < ARRAY_SIZE(desc->goa_odd_timing); i++) {
                 if (desc->goa_odd_timing[i])
                         num_zero++;
         }

         if (num_zero == ARRAY_SIZE(desc->goa_odd_timing))
                 goa_odd_valid = false;

         /* Up to 3 zeroes is a valid config. Check them all. */
         num_zero = 1;
         for (i = 0; i < ARRAY_SIZE(desc->goa_even_timing); i++) {
                 if (desc->goa_even_timing[i])
                         num_zero++;
         }

         if (num_zero == ARRAY_SIZE(desc->goa_even_timing))
                 goa_even_valid = false;


and so the following two checks on the boolean variables is on 
potentially uninitialized values:

         /* Programming one without the other would make no sense! */
         if (goa_odd_valid != goa_even_valid)
                 return -EINVAL;

         /* We know that both are either true or false now, check just 
one */
         if (!goa_odd_valid)
                 hx->skip_goa_timing = true;


Colin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x68C287DFC6A80226.asc
Type: application/pgp-keys
Size: 4824 bytes
Desc: OpenPGP public key
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250422/5cffce2c/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250422/5cffce2c/attachment.sig>


More information about the dri-devel mailing list