MTD pointer alignment

Gavin Lambert gavinl at compacsort.com
Tue Nov 28 19:09:08 EST 2006


Given that mtdchar assumes that it can mess with the low 2 bits of the
MTD pointer it keeps around with impunity, add_mtd_device in mtdcore.c
should probably refuse to add any MTD device pointer that doesn't fall
on a 4-byte boundary.

As of kernel 2.6.15, at least, it happily adds it, leading to much
weirdness if the pointer wasn't actually aligned that way (which can
happen if it's embedded in a structure -- since struct mtd_info starts
with a byte-sized field then by default the structure as a whole is
allowed to be byte aligned).





More information about the linux-mtd mailing list