Re: [PATCH 23/29] IB/mlx4: Improve size determinations in create_qp_common()

From: Majd Dibbiny
Date: Sun Feb 19 2017 - 14:54:25 EST



> On Feb 18, 2017, at 11:15 PM, SF Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Sat, 18 Feb 2017 18:29:30 +0100
>
> Replace the specification of two data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determinations a bit safer according to the Linux coding style convention.
>
> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/infiniband/hw/mlx4/qp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index 11fec4a8fae5..cc7bd257a1fd 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -691,14 +691,14 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
> if (qp_type == MLX4_IB_QPT_SMI || qp_type == MLX4_IB_QPT_GSI ||
> (qp_type & (MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_SMI_OWNER |
> MLX4_IB_QPT_PROXY_GSI | MLX4_IB_QPT_TUN_SMI_OWNER))) {
> - sqp = kzalloc(sizeof (struct mlx4_ib_sqp), gfp);
> + sqp = kzalloc(sizeof(*sqp), gfp);
> if (!sqp)
> return -ENOMEM;
> qp = &sqp->qp;
> qp->pri.vid = 0xFFFF;
> qp->alt.vid = 0xFFFF;
> } else {
> - qp = kzalloc(sizeof (struct mlx4_ib_qp), gfp);
> + qp = kzalloc(sizeof(*qp), gfp);
> if (!qp)
> return -ENOMEM;
> qp->pri.vid = 0xFFFF;
> --
> 2.11.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Reviewed-by: Majd Dibbiny
<majd@xxxxxxxxxxxx>