Hi Boris, > > > + > > > + if (full_erase) { > > > + off = 0; > > > + len = mtd->size; > > > + } > > > + > > > + if ((u32)off % mtd->erasesize) { > > > > Sounds dangerous. We have 8GB NANDs on sunxi platforms... > > [...] > > > > + > > > + if ((u32)len % mtd->erasesize) { > > > > Same here. I guess there's a do_div() in uboot. > > In both cases I take the less significant bytes of a 64-bit value. The > modulo operation is safe as long as mtd->erasesize is a 32-bit value > too. I don't think there is any danger?
As discussed out of this thread, this works because mtd->erasesize is always a power of 2. Erase sizes not being a power of 2 do not exist but it will be safer to switch to do_div(). Thanks, Miquèl _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot