Re: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

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

 



* Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 03/18, Ingo Molnar wrote:
> >
> > But ... no strong feelings from me, I'm not NAK-ing it or anything,
> > maybe I'd have used this well-known pattern:
> >
> > 	threads = min(max(MIN_THREADS, threads), MAX_THREADS);
> >
> > instead of:
> >
> > > >> +	if (threads > MAX_THREADS)
> > > >> +		threads = MAX_THREADS;
> > > >> +
> > > >> +	if (threads < MIN_THREADS)
> > > >> +		threads = MIN_THREADS;
> 
> 	clamp(threads, MIN_THREADS, MAX_THREADS)
> 
> ;)

Indeed ;-)

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux