public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] staging: lustre: ptlrpc: silence a shift wrapping warning
@ 2017-01-15  8:14 Dan Carpenter
  2017-01-16  3:33 ` [lustre-devel] " Oleg Drokin
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-01-15  8:14 UTC (permalink / raw)
  To: lustre-devel

"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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I have not tested this change.

diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c
index 49f3e63..ae1650d 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
@@ -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;
 	}
 

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

* Re: [lustre-devel] [patch] staging: lustre: ptlrpc: silence a shift wrapping warning
  2017-01-15  8:14 [patch] staging: lustre: ptlrpc: silence a shift wrapping warning Dan Carpenter
@ 2017-01-16  3:33 ` Oleg Drokin
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Drokin @ 2017-01-16  3:33 UTC (permalink / raw)
  To: lustre-devel


On Jan 15, 2017, at 3:14 AM, Dan Carpenter wrote:

> "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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>

> ---
> I have not tested this change.
> 
> diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c
> index 49f3e63..ae1650d 100644
> --- a/drivers/staging/lustre/lustre/ptlrpc/events.c
> +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
> @@ -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
> lustre-devel@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org


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

end of thread, other threads:[~2017-01-16  3:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-15  8:14 [patch] staging: lustre: ptlrpc: silence a shift wrapping warning Dan Carpenter
2017-01-16  3:33 ` [lustre-devel] " Oleg Drokin

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