tech-kern archive

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

Re: Undefined int shift in ifwatchd



On Wed, Jan 27, 2016 at 12:37:07PM -0500, Michael McConville wrote:
> I think my analysis here applies to this instance as well:
> 
> https://marc.info/?l=openbsd-tech&m=145377854103866&w=2
> 
> I also changed the chained condition to a switch statement because I
> find that more readable.

Yeah, copy & paste shit.

I find the loop evil even if using unsigned int.

How about defining a RTA_ALL_MASK (or however we'd call it, defined as
0x1ff) and write:

	for (i = 1; i & RTA_ALL_MASK; i <<= 1) {

?

Thanks for pointing this out!

Martin


Home | Main Index | Thread Index | Old Index