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.
> id1 = codec->codec_read(codec, AC97_VENDOR_ID1);
> id2 = codec->codec_read(codec, AC97_VENDOR_ID2);
> for (i = 0; i < ARRAY_SIZE(ac97_codec_ids); i++) {
> if (ac97_codec_ids[i].id == ((id1 << 16) | id2)) {
> codec->type = ac97_codec_ids[i].id;
> codec->name = ac97_codec_ids[i].name;
> codec->codec_ops = ac97_codec_ids[i].ops;
> break;
> }
> }
>
> If id1 and id2 happen to be 0, it matches the last entry and codec_ops
> is set to uncertain value(maybe 0). it may cause the oops in ac97_init_mixer().
Robert Love
-
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/