Skip to contentSkip to conversation

dvb_frontend_swzigzag(): uninitialized variable usage

DISCUSSION Adrian Bunk 2 participants 2 messages Nov 6, 2006 – Nov 17, 2006

lore
Share & tools
lore
#0 lore raw

The Coverity checker spotted the following in
drivers/media/dvb/dvb-core/dvb_frontend.c:

<-- snip -->

...
static void dvb_frontend_swzigzag(struct dvb_frontend *fe)

{
        fe_status_t s;
        struct dvb_frontend_private *fepriv = fe->frontend_priv;

        /* if we've got no parameters, just keep idling */
        if (fepriv->state & FESTATE_IDLE) {
                fepriv->delay = 3*HZ;
                fepriv->quality = 0;
                return;
        }

        /* in SCAN mode, we just set the frontend when asked and leave it alone */
        if (fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT) {
                if (fepriv->state & FESTATE_RETUNE) {
                        if (fe->ops.set_frontend)
                                fe->ops.set_frontend(fe, &fepriv->parameters);
                        fepriv->state = FESTATE_TUNED;
                }
                fepriv->delay = 3*HZ;
                fepriv->quality = 0;
                return;
        }

        /* get the frontend status */
        if (fepriv->state & FESTATE_RETUNE) {
                s = 0;
        } else {
                if (fe->ops.read_status)
                        fe->ops.read_status(fe, &s);
                if (s != fepriv->status) {
                        dvb_frontend_add_event(fe, s);
                        fepriv->status = s;
                }
        }

...

<-- snip -->

Note that in the "if (s != fepriv->status)", "s" could be used uninitialized.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#1 lore raw
Quoted 9 lines · Adrian Bunk

The Coverity checker spotted the following in
drivers/media/dvb/dvb-core/dvb_frontend.c:

<-- snip -->

...
static void dvb_frontend_swzigzag(struct dvb_frontend *fe)

{
        fe_status_t s;

[snip]

thanks, fix should be in HG soon.