This is clearly wrong.  Since `chan` is a `u32`, it is a really big number if it ==-1.  `chans[really big number]` is a buffer overflow.

Even if it were signed, `chans[-1]` would still be a buffer overflow.

-[Unknown]