[PATCH] [MTD] Make ecclayout static const
Kyungmin Park
kmpark at infradead.org
Mon Feb 12 00:36:28 EST 2007
There's missing one in OneNAND.
>
> - for (free = this->ecclayout->oobfree; free->length; ++free) {
> + free = this->ecclayout->oobfree;
> + for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree);
> i++, free++) {
After changint "static const" If we only check the free->length, it can
point beyond the ecclayout->oobfree. Since it casts the free pointer and
only check length.
If we only check the array_size, it mis-calculate the readcol & readend in
1KB page OneNAND
So we have to check both array_size and free->length.
for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree) && free->length; i++,
free++)
>
> @@ -1270,19 +1277,22 @@ static int
> onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
> const u_char *buf, int column, int
> thislen)
> {
>
> - for (free = this->ecclayout->oobfree; free->length; ++free) {
> + free = this->ecclayout->oobfree;
> + for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree);
> i++, free++) {
Same as above
After previous mail comments. I will post it again.
Thank you,
Kyungmin Park
More information about the linux-mtd
mailing list