Skip to contentSkip to conversation

drm: panel: Add driver for Himax HX8279 DDIC panels

DISCUSSION Colin King (gmail) 1 participant 1 message Apr 22, 2025

lore
Share & tools
lore
#0 lore raw

Hi,

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

commit 38d42c261389985e8dd4739dbd97e2dc855e8dd0

Author: AngeloGioacchino Del Regno <[email protected]>
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