On 7/11/12 3:05 PM, Theodore Ts'o wrote: > On Wed, Jul 11, 2012 at 10:04:51AM -0500, Eric Sandeen wrote: ... >> I think Gordan suggested (if I understand it >> right) that doing an array of ints might also solve the problem, since >> ints should be on natural alignment. Or maybe in some cases malloc/free >> would be more obvious, if handling errors isn't too tricky. > > In the specific case which Gordon has pointed out, the obvious thing > to do is to just to set errno to ENOMEM, and return -1. since we > already reflect an error code up to the caller if the FIEMAP ioctl() > fails. > > If someone sends me the patch, I will happily apply it. Sure, I was planning on it :) >> (IIRC "make gcc-wall" will also emit warnings for casts which change >> natural alignment, among other things) > > I'd have to check to be sure, but I don't think so, since it would > have way too many false positives. We *do* have code where we take > char *'s and and then cast them to some other pointer type, and then > dereference them. And we do currently assume that it is safe to do > this for on-disk data structures which are 4 byte aligned, in the > directory entry code, for example. > > I will *not* accept a patch which uses memcpy to copy each field in > the on-disk superblock, or directory entry, into an int, just in case > there is some insane architecture which requires that 4 byte integers > be 32-byte aligned, or something else insane like that. Well, let's just see where we're at, first, and see what it'll take, case by case. -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html