Re: [Slightly off topic] A question about R/B trees.
From: Chris Friesen
Date: Mon Oct 20 2008 - 10:55:00 EST
Maxim Levitsky wrote:
Say you allocate a piece of memory using kmalloc, and write there, a
structure that contains a r/b tree item. I agree that gcc will ensure
that offset from start of that structure to first byte of the tree
item will be aligned.
But what if malloc returned a misaligned pointer? This will ensure
that virtual address of the tree item won't be aligned. (I know it
doesn't, but this isn't a assumption about gcc anymore)
malloc() can't return a misaligned pointer. From the spec: "The
pointer returned if the allocation succeeds shall be suitably aligned so
that it may be assigned to a pointer to any type of object..."
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/