From: Xiubo Li Date: Thu, 21 Apr 2022 10:15:20 +0000 (+0800) Subject: client: fix compile warning and incorrect computing the max_fwd X-Git-Tag: v18.0.0~974^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6a28c337d9c669f49855367da4dc91131b836b94;p=ceph.git client: fix compile warning and incorrect computing the max_fwd warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses] max_fwd = 1 << (max_fwd * CHAR_BIT) - 1; ~~~~~~~~~~~~~~~~~~~~~^~~ And also the '-' has precedence over the '<<', more detail please see https://en.cppreference.com/w/c/language/operator_precedence. Fixes: https://tracker.ceph.com/issues/55409 Reported-by: Jos Collin Reported-by: Rishabh Dave Signed-off-by: Xiubo Li --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 9651509686d03..f206cefd381d5 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2552,7 +2552,7 @@ void Client::handle_client_request_forward(const MConstRefnum_fwd); - max_fwd = 1 << (max_fwd * CHAR_BIT) - 1; + max_fwd = (1 << (max_fwd * CHAR_BIT)) - 1; auto num_fwd = fwd->get_num_fwd(); if (num_fwd <= request->num_fwd || num_fwd >= max_fwd) { if (request->num_fwd >= max_fwd || num_fwd >= max_fwd) {