[PATCH pahole 4/4] reorganize: shift tail members for non-bitfields only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrii Nakryiko <andriin@xxxxxx>

Current logic in some cases will move bitfield member and then will
shift all the following members by the size of underlying base type of
bitfield, which is wrong, as bitfield's size doesn't correspond to the
size of underlying base type.

Without this fix, reorganizing struct net_device would emit BRAING
FARTs. Now it doesn't.

Signed-off-by: Andrii Nakryiko <andriin@xxxxxx>
---
 dwarves_reorganize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dwarves_reorganize.c b/dwarves_reorganize.c
index 9b3aea2..e48d8d5 100644
--- a/dwarves_reorganize.c
+++ b/dwarves_reorganize.c
@@ -321,7 +321,7 @@ static void class__move_member(struct class *class, struct class_member *dest,
 		}
 	} else if (from_was_last) {
 		class->type.size -= from_size + class->padding;
-	} else {
+	} else if (from->bitfield_size == 0) {
 		/*
 		 * See if we are adding a new hole that is bigger than
 		 * sizeof(long), this may have problems with explicit alignment
-- 
2.17.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux