Re: [PATCH 2/3] IB/srp: Enclose 14 expressions for the sizeof operator by parentheses

From: Joe Perches
Date: Sat Apr 08 2017 - 10:50:58 EST


On Sat, 2017-04-08 at 14:12 +0200, SF Markus Elfring wrote:
[]
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
[]
> @@ -3308,7 +3308,7 @@ static ssize_t srp_create_target(struct device *dev,
> target_host->max_channel = 0;
> target_host->max_id = 1;
> target_host->max_lun = -1LL;
> - target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;
> + target_host->max_cmd_len = sizeof(((struct srp_cmd *)(void *)0L)->cdb);

Maybe better as:

target_host->max_cmd_len = FIELD_SIZEOF(struct srp_cmd, cdb);