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 <jcollin@redhat.com>
Reported-by: Rishabh Dave <ridave@redhat.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
* using the hardcode here.
*/
int max_fwd = sizeof(((struct ceph_mds_request_head*)0)->num_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) {