public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [patch v2] IB/ipath: silence a static checker warning
       [not found] ` <32E1700B9017364D9B60AED9960492BC0D5C9939-AtyAts71sc88Ug9VwtkbtrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2013-03-18 20:25   ` Dan Carpenter
       [not found]     ` <20130318202526.GA11268-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-03-18 20:25 UTC (permalink / raw)
  To: Mike Marciniszyn
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
v2: new changelog.  Just mask the value instead of adding an if
statement.

diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 439c35d..ea93870 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -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++;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [patch v2] IB/ipath: silence a static checker warning
       [not found]     ` <20130318202526.GA11268-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
@ 2013-03-19 20:32       ` Marciniszyn, Mike
  0 siblings, 0 replies; 2+ messages in thread
From: Marciniszyn, Mike @ 2013-03-19 20:32 UTC (permalink / raw)
  To: Dan Carpenter, infinipath
  Cc: Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

> Subject: [patch v2] IB/ipath: silence a static checker warning

Thanks for the patch!

Acked-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-19 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <32E1700B9017364D9B60AED9960492BC0D5C9939@FMSMSX108.amr.corp.intel.com>
     [not found] ` <32E1700B9017364D9B60AED9960492BC0D5C9939-AtyAts71sc88Ug9VwtkbtrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-03-18 20:25   ` [patch v2] IB/ipath: silence a static checker warning Dan Carpenter
     [not found]     ` <20130318202526.GA11268-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2013-03-19 20:32       ` Marciniszyn, Mike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox