linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-core] mlx4: Fix 1<<31 expressions
@ 2018-02-08 23:38 Jason Gunthorpe
       [not found] ` <20180208233829.GA16128-uk2M96/98Pc@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Jason Gunthorpe @ 2018-02-08 23:38 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

They produce the value INT32_MIN not 0x80000000. This is sometimes OK
if it is casted appropriately but leaves a subtle trap to the user.

Signed-off-by: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 providers/mlx4/mlx4dv.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/providers/mlx4/mlx4dv.h b/providers/mlx4/mlx4dv.h
index d47d3cd2e1f135..5312a866b6e281 100644
--- a/providers/mlx4/mlx4dv.h
+++ b/providers/mlx4/mlx4dv.h
@@ -288,12 +288,12 @@ enum {
 };
 
 enum {
-	MLX4_WQE_BIND_TYPE_2		= (1<<31),
+	MLX4_WQE_BIND_TYPE_2		= (1UL<<31),
 	MLX4_WQE_BIND_ZERO_BASED	= (1<<30),
 };
 
 enum {
-	MLX4_INLINE_SEG		= 1 << 31,
+	MLX4_INLINE_SEG		= 1UL << 31,
 	MLX4_INLINE_ALIGN	= 64,
 };
 
@@ -304,7 +304,7 @@ enum {
 enum {
 	MLX4_WQE_MW_REMOTE_READ   = 1 << 29,
 	MLX4_WQE_MW_REMOTE_WRITE  = 1 << 30,
-	MLX4_WQE_MW_ATOMIC        = 1 << 31
+	MLX4_WQE_MW_ATOMIC        = 1UL << 31
 };
 
 struct mlx4_wqe_local_inval_seg {
-- 
2.16.1

--
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] 12+ messages in thread

end of thread, other threads:[~2018-02-09 17:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 23:38 [PATCH rdma-core] mlx4: Fix 1<<31 expressions Jason Gunthorpe
     [not found] ` <20180208233829.GA16128-uk2M96/98Pc@public.gmane.org>
2018-02-09 16:01   ` Bart Van Assche
     [not found]     ` <1518192109.2871.5.camel-Sjgp3cTcYWE@public.gmane.org>
2018-02-09 16:10       ` Jason Gunthorpe
     [not found]         ` <20180209161030.GA7584-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-02-09 16:12           ` Parav Pandit
     [not found]             ` <HE1PR0502MB3004BB45FC9ADB9B49CAF283D1F20-692Kmc8YnlL9PhveBwpv4cDSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2018-02-09 16:13               ` Jason Gunthorpe
     [not found]                 ` <20180209161325.GD7570-uk2M96/98Pc@public.gmane.org>
2018-02-09 16:20                   ` Parav Pandit
2018-02-09 16:42                   ` Leon Romanovsky
     [not found]                     ` <20180209164200.GO2197-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-02-09 16:51                       ` Jason Gunthorpe
     [not found]                         ` <20180209165138.GA11850-uk2M96/98Pc@public.gmane.org>
2018-02-09 16:55                           ` Leon Romanovsky
2018-02-09 16:19               ` Bart Van Assche
     [not found]                 ` <1518193161.2871.14.camel-Sjgp3cTcYWE@public.gmane.org>
2018-02-09 16:24                   ` Jason Gunthorpe
     [not found]                     ` <20180209162453.GD7584-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-02-09 17:18                       ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).