Skip to contentSkip to conversation

IB/ipath: silence a static checker warning

PATCH In review Dan Carpenter 2 participants 2 messages Mar 18, 2013 – Mar 19, 2013 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 32E1700B9017364D9B60AED9960492BC0D5C9939@FMSMSX108.amr.corp.intel.com

A message that is not in the archive (sent off-list or not yet received): 32E1700B9017364D9B60AED9960492BC0D5C9939-AtyAts71sc88Ug9VwtkbtrfspsVTdybXVpNB7YpNyf8@public.gmane.org

#2 lore raw

PATCH v2 1/1 IB/ipath: silence a static checker warning

I have a static checker which complains that 0x255 is too high for the "dev->opstats[opcode]" array. It turns out that the hardware has already validated the opcode at this point so it can't actually overflow.

However, silencing the warning is good and this matches how the opcode is treated in qib_ib_rcv() as well.

---
v2: new changelog. Just mask the value instead of adding an if statement.

drivers/infiniband/hw/ipath/ipath_verbs.c +1 -1
index 439c35d..ea93870 100644
@@ -620,7 +620,7 @@ void ipath_ib_rcv(struct ipath_ibdev *dev, void *rhdr, void *data,
 		goto bail;
 	}
 
-	opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
+	opcode = (be32_to_cpu(ohdr->bth[0]) >> 24) & 0x7f;
 	dev->opstats[opcode].n_bytes += tlen;
 	dev->opstats[opcode].n_packets++;
 

A message that is not in the archive (sent off-list or not yet received): 20130318202526.GA11268-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org