[RFC 3/5] mtd: do not assume oobsize is power of 2
Artem Bityutskiy
dedekind1 at gmail.com
Mon Aug 22 04:46:56 EDT 2011
On Wed, 2011-08-17 at 16:50 -0700, Brian Norris wrote:
> Previous generations of MTDs all used OOB sizes that were powers of 2,
> (e.g., 64, 128). However, newer generations of flash, especially NAND,
> use irregular OOB sizes that are not powers of 2 (e.g., 218, 224, 448).
> This means we cannot use masks like "mtd->oobsize - 1" to assume that we
> will get a proper bitmask for OOB operations.
>
> As I see it, we don't actually need these masks anyway, so kill them.
>
> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Once you double checked that you caught all the places which assume
power-of-2 and do things like "x & (mtd->oobsize - 1", and once you
confirmed that you did some basic test by running few nandwrite commands
which involve OOB operations, I think this patch can go in
independently.
IOW, this does need to be RFC, IMO.
But yes, if there is a buggy piece of user-space code which uses
non-aligned offsets, and kernel alignes them - this change will break
it. IOW, this patch may expose bugs in user-space code. This is kind of
ABI break, but I think for MTD which is not very widely used, we can do
things like this.
IOW, I understand that this may break some user-space program, but
working with MTD for many years I thing there are very very little of
such programs and I think it is not a huge issue.
--
Best Regards,
Artem Bityutskiy
More information about the linux-mtd
mailing list