Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1228890 > unrolled thread
| Started by | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
|---|---|
| First post | 2015-09-20 16:10 +0200 |
| Last post | 2015-09-21 16:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] staging/rdma/hfi1: do not use u8 to store a 32-bit integer Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2015-09-20 16:10 +0200
RE: [PATCH] staging/rdma/hfi1: do not use u8 to store a 32-bit integer "Marciniszyn, Mike" <mike.marciniszyn@intel.com> - 2015-09-21 16:50 +0200
| From | Nicolas Iooss <nicolas.iooss_linux@m4x.org> |
|---|---|
| Date | 2015-09-20 16:10 +0200 |
| Subject | [PATCH] staging/rdma/hfi1: do not use u8 to store a 32-bit integer |
| Message-ID | <qaNtv-245-7@gated-at.bofh.it> |
hfi1_rc_hdrerr() stores the result of be32_to_cpu() into opcode, which
is a local variable declared as u8. Later this variable is used in a
24-bit logical right shift, which makes clang complains (when building
an allmodconfig kernel with LLVMLinux patches):
drivers/staging/rdma/hfi1/rc.c:2399:9: warning: shift count >= width
of type [-Wshift-count-overflow]
opcode >>= 24;
^ ~~
All of this lead to the point that opcode may have been designed to be
a 32-bit integer instead of an 8-bit one. Therefore make this variable
u32.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
drivers/staging/rdma/hfi1/rc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rdma/hfi1/rc.c b/drivers/staging/rdma/hfi1/rc.c
index 632dd5ba7dfd..1e9caebb0281 100644
--- a/drivers/staging/rdma/hfi1/rc.c
+++ b/drivers/staging/rdma/hfi1/rc.c
@@ -2383,7 +2383,7 @@ void hfi1_rc_hdrerr(
struct hfi1_other_headers *ohdr;
struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
int diff;
- u8 opcode;
+ u32 opcode;
u32 psn;
/* Check for GRH */
--
2.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Marciniszyn, Mike" <mike.marciniszyn@intel.com> |
|---|---|
| Date | 2015-09-21 16:50 +0200 |
| Subject | RE: [PATCH] staging/rdma/hfi1: do not use u8 to store a 32-bit integer |
| Message-ID | <qbazL-1aG-1@gated-at.bofh.it> |
| In reply to | #1228890 |
> Subject: [PATCH] staging/rdma/hfi1: do not use u8 to store a 32-bit integer > Thanks for the patch! Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web