[PATCHv2 5/5] sparse: Also check bit_offset when checking implicit casts

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

 



From: Franz Schrober <franzschrober@xxxxxxxx>

The comparison in same_cast_type only checked the bit_size of the new and the
old symbol. The bit_offset was only compared with itself and thus would always
be true. Instead Linus most likely wanted to compare the bit_offset of the new
and the old symbol. This regression was introduced in
47f53396a1d62719c44941f84370ead80181728e ("If two implied casts end up undoing
each other, just remove them.").

Reported-by: James Westby <jw+debian@xxxxxxxxxxxxxxx>
Signed-off-by: Franz Schrober <franzschrober@xxxxxxxx>
---
 evaluate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/evaluate.c b/evaluate.c
index 5b643d8..6655615 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -191,7 +191,8 @@ left:
 
 static int same_cast_type(struct symbol *orig, struct symbol *new)
 {
-	return orig->bit_size == new->bit_size && orig->bit_offset == orig->bit_offset;
+	return orig->bit_size == new->bit_size &&
+	       orig->bit_offset == new->bit_offset;
 }
 
 static struct symbol *base_type(struct symbol *node, unsigned long *modp, unsigned long *asp)
-- 
1.8.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux