Re: SiS/Trident 4DWave sound driver oops

Tachino Nobuhiro (tachino@open.nm.fujitsu.co.jp)
Fri, 26 Oct 2001 11:36:34 +0900


At 25 Oct 2001 22:02:20 -0400,
Robert Love wrote:
>
> On Thu, 2001-10-25 at 21:56, Tachino Nobuhiro wrote:
> > Robert Love wrote:
> > > Hm, I don't think so. The last area is marked zero so code can know
> > > when it ends. This is common practice.
> >
> > But the code does not use the last area. this is the code in
> > ac97_probe_codec().
>
> ARRAY_SIZE(x) returns the number of elements in x, but since everything
> is 0-referenced going from 0 to i < ARRAY_SIZE isn't a problem.
>
> ie int x[3];
> ARRAY_SIZE(x) = 3;
> but x[2] is last element... so no issue here.

No. {0, } is the last elemnet of ac97_codec_ids[] and that index is
ARRAY_SIZE(ac97_code_ids) - 1. So this element which should be used as
a loop terminator is used as a valid entry in for loop incorrectly.

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