Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: dvb_demux.c



On Fri, Oct 31, 2003 at 03:20:40PM +0100, Matthias Biel wrote:
> emard@softhome.net wrote:
> 
> >We should instead of while(!count) or while(count != 0) Always use 
> >expressions
> >like while(count > 0), because ">' operator provides safe exit from 
> >loop...
> 
> unsigned variables ?!
> 

It is better to not let the author in the position he must think
is he using unsigned or signed variables

If we e.g. know that count is always less than 1000, then this is
IMHO a very safe way to do loops that are aiming at stable code
and are proof to input junk data:

if(count < 1000)
  for(; --count > 0; )
  { 
    /* hackers_code which can crash the kernel if the
    ** count is negative (when signed) or larger than 1000
    */ 
  }

Emard


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index