Skip to contentSkip to conversation

staging: lustre: ptlrpc: silence a shift wrapping warning

PATCH In review Dan Carpenter 2 participants 2 messages Jan 15, 2017 – Jan 16, 2017

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

PATCH 1/1 staging: lustre: ptlrpc: silence a shift wrapping warning

"svcpt->scp_hist_seq" is a u64 so static checkers complain that 1U should be 1ULL. I looked at REQS_SEQ_SHIFT() a little and it seems to be capped by the number of CPUs online and the amount of memory, but I think it could go above 32 possibly.

---
I have not tested this change.

drivers/staging/lustre/lustre/ptlrpc/events.c +1 -1
index 49f3e63..ae1650d 100644
@@ -277,7 +277,7 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt,
 		 * then we hope there will be less RPCs per bucket at some
 		 * point, and sequence will catch up again
 		 */
-		svcpt->scp_hist_seq += (1U << REQS_SEQ_SHIFT(svcpt));
+		svcpt->scp_hist_seq += (1ULL << REQS_SEQ_SHIFT(svcpt));
 		new_seq = svcpt->scp_hist_seq;
 	}
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

"svcpt->scp_hist_seq" is a u64 so static checkers complain that 1U should be 1ULL. I looked at REQS_SEQ_SHIFT() a little and it seems to be capped by the number of CPUs online and the amount of memory, but I think it could go above 32 possibly.

Quoted 20 lines

---
I have not tested this change.

drivers/staging/lustre/lustre/ptlrpc/events.c +1 -1
index 49f3e63..ae1650d 100644
@@ -277,7 +277,7 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt,
 		 * then we hope there will be less RPCs per bucket at some
 		 * point, and sequence will catch up again
 		 */
-		svcpt->scp_hist_seq += (1U << REQS_SEQ_SHIFT(svcpt));
+		svcpt->scp_hist_seq += (1ULL << REQS_SEQ_SHIFT(svcpt));
 		new_seq = svcpt->scp_hist_seq;
 	}
 

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org