The Coverity checker spotted the following buggy code in 
drivers/media/dvb/frontends/tda10023.c:

<--  snip  -->

...
#define XTAL   28920000UL
#define PLL_M  8UL
#define PLL_P  4UL
#define PLL_N  1UL
#define SYSCLK (XTAL*PLL_M/(PLL_N*PLL_P))  // -> 57840000
...
static int tda10023_set_symbolrate (struct tda10023_state* state, u32 sr)
{
...
        if (sr<870000)
                sr=870000;

        if (sr < (u32)(SYSCLK/98.40)) {
                NDEC=3;
                SFIL=1;
        } else if (sr<(u32)(SYSCLK/64.0)) {
                NDEC=3;
                SFIL=0;
        } else if (sr<(u32)(SYSCLK/49.2)) {
                NDEC=2;
                SFIL=1;
        } else if (sr<(u32)(SYSCLK/32.0)) {
                NDEC=2;
                SFIL=0;
        } else if (sr<(u32)(SYSCLK/24.6)) {
                NDEC=1;
                SFIL=1;
        } else if (sr<(u32)(SYSCLK/16.0)) {
                NDEC=1;
                SFIL=0;
        } else if (sr<(u32)(SYSCLK/12.3)) {
                NDEC=0;
                SFIL=1;
        }
...
}
...

<--  snip  -->


57840000 / 98.40 = 587804 < 870000


cu
Adrian

-- 

       "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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to