mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* re: drm: panel: Add driver for Himax HX8279 DDIC panels
@ 2025-04-22 21:41 Colin King (gmail)
  0 siblings, 0 replies; only message in thread
From: Colin King (gmail) @ 2025-04-22 21:41 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Neil Armstrong
  Cc: dri-devel, devicetree, linux-kernel, kernel, Richard_j_nixon


[-- Attachment #1.1.1: Type: text/plain, Size: 1882 bytes --]

Hi,

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

commit 38d42c261389985e8dd4739dbd97e2dc855e8dd0
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@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

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-22 21:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-22 21:41 drm: panel: Add driver for Himax HX8279 DDIC panels Colin King (gmail)

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®