Skip to contentSkip to conversation

fcoe: precedence bug in fcoe_filter_frames()

PATCH New Dan Carpenter 1 participant 1 message Feb 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fcoe: precedence bug in fcoe_filter_frames()

Negate has higher precedence than bitwise AND. FCPHF_CRC_UNCHECKED is 0x1 so the original code is equivalent to: if (!fr_flags(fp)) { ...

drivers/scsi/fcoe/fcoe.c +1 -1
index 495456f..a2875d9 100644
@@ -1546,7 +1546,7 @@ static inline int fcoe_filter_frames(struct fc_lport *lport,
 		return -EINVAL;
 	}
 
-	if (!fr_flags(fp) & FCPHF_CRC_UNCHECKED ||
+	if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED) ||
 	    le32_to_cpu(fr_crc(fp)) == ~crc32(~0, skb->data, skb->len)) {
 		fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED;
 		return 0;