linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Majd Dibbiny <majd@mellanox.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	"Leon Romanovsky" <leonro@mellanox.com>,
	Matan Barak <matanb@mellanox.com>,
	"Sean Hefty" <sean.hefty@intel.com>,
	Yishai Hadas <yishaih@mellanox.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses
Date: Sun, 19 Feb 2017 17:21:58 +0000	[thread overview]
Message-ID: <DC6B3471-8721-49CA-B2E3-CA883E60D341@mellanox.com> (raw)
In-Reply-To: <c535767b-0cbd-e8e6-e7b0-f2b05cfd05e5@users.sourceforge.net>


> On Feb 18, 2017, at 10:59 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote:
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 18 Feb 2017 09:54:15 +0100
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> WARNING: sizeof … should be sizeof(…)
> 
> Thus fix the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/infiniband/hw/mlx4/mad.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
> index 860fec8b9601..b26817f0669f 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -195,7 +195,7 @@ static void update_sm_ah(struct mlx4_ib_dev *dev, u8 port_num, u16 lid, u8 sl)
>    if (!dev->send_agent[port_num - 1][0])
>        return;
> 
> -    memset(&ah_attr, 0, sizeof ah_attr);
> +    memset(&ah_attr, 0, sizeof(ah_attr));
>    ah_attr.dlid     = lid;
>    ah_attr.sl       = sl;
>    ah_attr.port_num = port_num;
> @@ -400,7 +400,7 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m
>         * it's OK for our devices).
>         */
>        spin_lock_irqsave(&dev->sm_lock, flags);
> -        memcpy(send_buf->mad, mad, sizeof *mad);
> +        memcpy(send_buf->mad, mad, sizeof(*mad));
>        send_buf->ah = dev->sm_ah[port_num - 1];
>        if (send_buf->ah)
>            ret = ib_post_send_mad(send_buf, NULL);
> @@ -555,7 +555,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
> 
>    /* create ah. Just need an empty one with the port num for the post send.
>     * The driver will set the force loopback bit in post_send */
> -    memset(&attr, 0, sizeof attr);
> +    memset(&attr, 0, sizeof(attr));
>    attr.port_num = port;
>    if (is_eth) {
>        union ib_gid sgid;
> @@ -590,8 +590,8 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
> 
>    /* copy over to tunnel buffer */
>    if (grh)
> -        memcpy(&tun_mad->grh, grh, sizeof *grh);
> -    memcpy(&tun_mad->mad, mad, sizeof *mad);
> +        memcpy(&tun_mad->grh, grh, sizeof(*grh));
> +    memcpy(&tun_mad->mad, mad, sizeof(*mad));
> 
>    /* adjust tunnel data */
>    tun_mad->hdr.pkey_index = cpu_to_be16(tun_pkey_ix);
> @@ -961,7 +961,7 @@ static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
>    }
>    mutex_unlock(&dev->counters_table[port_num - 1].mutex);
>    if (stats_avail) {
> -        memset(out_mad->data, 0, sizeof out_mad->data);
> +        memset(out_mad->data, 0, sizeof(out_mad->data));
>        switch (counter_stats.counter_mode & 0xf) {
>        case 0:
>            edit_counter(&counter_stats,
> @@ -1136,11 +1136,11 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
>    if (!mlx4_is_mfunc(dev->dev) || !mlx4_is_master(dev->dev))
>        return;
> 
> -    in_mad  = kmalloc(sizeof *in_mad, GFP_KERNEL);
> +    in_mad  = kmalloc(sizeof(*in_mad), GFP_KERNEL);
>    if (!in_mad)
>        return;
> 
> -    out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
> +    out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL);
>    if (!out_mad)
>        goto free_in_mad;
> 
> @@ -1149,8 +1149,8 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
>    for (i = 0; i < 4; i++) {
>        if (change_bitmap && (!((change_bitmap >> (8 * i)) & 0xff)))
>            continue;
> -        memset(in_mad, 0, sizeof *in_mad);
> -        memset(out_mad, 0, sizeof *out_mad);
> +        memset(in_mad, 0, sizeof(*in_mad));
> +        memset(out_mad, 0, sizeof(*out_mad));
> 
>        in_mad->base_version  = 1;
>        in_mad->mgmt_class    = IB_MGMT_CLASS_SUBN_LID_ROUTED;
> @@ -1421,7 +1421,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port,
>                   sizeof (struct mlx4_mad_snd_buf),
>                   DMA_TO_DEVICE);
> 
> -    memcpy(&sqp_mad->payload, mad, sizeof *mad);
> +    memcpy(&sqp_mad->payload, mad, sizeof(*mad));
> 
>    ib_dma_sync_single_for_device(&dev->ib_dev,
>                      sqp->tx_ring[wire_tx_ix].buf.map,
> @@ -1804,7 +1804,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
> 
>    tun_qp = &ctx->qp[qp_type];
> 
> -    memset(&qp_init_attr, 0, sizeof qp_init_attr);
> +    memset(&qp_init_attr, 0, sizeof(qp_init_attr));
>    qp_init_attr.init_attr.send_cq = ctx->cq;
>    qp_init_attr.init_attr.recv_cq = ctx->cq;
>    qp_init_attr.init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
> @@ -1837,7 +1837,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
>        return ret;
>    }
> 
> -    memset(&attr, 0, sizeof attr);
> +    memset(&attr, 0, sizeof(attr));
>    attr.qp_state = IB_QPS_INIT;
>    ret = 0;
>    if (create_tun)
> @@ -2184,7 +2184,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
>        goto err_mcg;
>    }
> 
> -    snprintf(name, sizeof name, "mlx4_ibt%d", port);
> +    snprintf(name, sizeof(name), "mlx4_ibt%d", port);
>    ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
>    if (!ctx->wq) {
>        pr_err("Failed to create tunnelling WQ for port %d\n", port);
> @@ -2192,7 +2192,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
>        goto err_wq;
>    }
> 
> -    snprintf(name, sizeof name, "mlx4_ibud%d", port);
> +    snprintf(name, sizeof(name), "mlx4_ibud%d", port);
>    ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
>    if (!ctx->ud_wq) {
>        pr_err("Failed to create up/down WQ for port %d\n", port);
> -- 
> 2.11.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thanks,
Reviewed-by: Majd Dibbiny
<majd@mellanox.com>

  reply	other threads:[~2017-02-19 17:22 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18 20:45 [PATCH 00/29] IB/mlx: Fine-tuning for several function implementations SF Markus Elfring
2017-02-18 20:47 ` [PATCH 01/29] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() SF Markus Elfring
2017-02-19 17:06   ` Majd Dibbiny
2017-02-18 20:49 ` [PATCH 02/29] IB/mlx4: Improve another size determination " SF Markus Elfring
2017-02-19 17:06   ` Majd Dibbiny
2017-02-18 20:50 ` [PATCH 03/29] IB/mlx4: Improve another size determination in mlx4_ib_alloc_demux_ctx() SF Markus Elfring
2017-02-19 17:06   ` Majd Dibbiny
2017-02-18 20:51 ` [PATCH 04/29] IB/mlx4: Improve another size determination in alloc_pv_object() SF Markus Elfring
2017-02-19 17:06   ` Majd Dibbiny
2017-02-18 20:52 ` [PATCH 05/29] IB/mlx4: Fix a typo in a comment line SF Markus Elfring
2017-02-19 17:06   ` Majd Dibbiny
2017-02-18 20:54 ` [PATCH 06/29] IB/mlx4: Delete three unnecessary return statements SF Markus Elfring
2017-02-19 17:06   ` Majd Dibbiny
2017-02-18 20:55 ` [PATCH 07/29] IB/mlx4: Split a condition check in handle_slaves_guid_change() SF Markus Elfring
2017-02-19 17:09   ` Majd Dibbiny
2017-02-18 20:56 ` [PATCH 08/29] IB/mlx4: Delete an unnecessary check before the function call "kfree" in free_pv_object() SF Markus Elfring
2017-02-19 17:11   ` Majd Dibbiny
2017-02-18 20:57 ` [PATCH 09/29] IB/mlx4: Move an assignment out of a check in forward_trap() SF Markus Elfring
2017-02-19 17:12   ` Majd Dibbiny
2017-02-18 20:58 ` [PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses SF Markus Elfring
2017-02-19 17:21   ` Majd Dibbiny [this message]
2017-02-18 20:59 ` [PATCH 11/29] IB/mlx4: Use kmalloc_array() in three functions SF Markus Elfring
2017-02-19 17:21   ` Majd Dibbiny
2017-02-18 21:00 ` [PATCH 12/29] IB/mlx4: Enclose 17 expressions for the sizeof operator by parentheses SF Markus Elfring
2017-02-19 17:21   ` Majd Dibbiny
2017-02-18 21:01 ` [PATCH 13/29] IB/mlx4: Split a condition check in five functions SF Markus Elfring
2017-02-19 17:21   ` Majd Dibbiny
2017-02-18 21:02 ` [PATCH 14/29] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() SF Markus Elfring
2017-02-18 21:03 ` [PATCH 15/29] IB/mlx4: Delete an unnecessary return statement in do_slave_init() SF Markus Elfring
2017-02-19 17:36   ` Majd Dibbiny
2017-02-18 21:04 ` [PATCH 16/29] IB/mlx4: Improve another size determination " SF Markus Elfring
2017-02-18 21:05 ` [PATCH 17/29] IB/mlx4: Improve another size determination in mlx4_ib_add() SF Markus Elfring
2017-02-19 17:36   ` Majd Dibbiny
2017-02-19 17:36   ` Majd Dibbiny
2017-02-18 21:06 ` [PATCH 18/29] IB/mlx4: Delete an unnecessary variable initialisation " SF Markus Elfring
2017-02-18 21:08 ` [PATCH 19/29] IB/mlx4: Delete an unnecessary variable assignment " SF Markus Elfring
2017-02-19 19:42   ` Majd Dibbiny
2017-02-18 21:10 ` [PATCH 20/29] IB/mlx4: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-02-19 19:48   ` Majd Dibbiny
2017-02-18 21:11 ` [PATCH 21/29] IB/mlx4: Delete unnecessary braces " SF Markus Elfring
2017-02-19 19:51   ` Majd Dibbiny
2017-02-18 21:12 ` [PATCH 22/29] IB/mlx4: Use kmalloc_array() in alloc_proxy_bufs() SF Markus Elfring
2017-02-19 19:53   ` Majd Dibbiny
2017-02-18 21:13 ` [PATCH 23/29] IB/mlx4: Improve size determinations in create_qp_common() SF Markus Elfring
2017-02-19 19:54   ` Majd Dibbiny
2017-02-18 21:14 ` [PATCH 24/29] IB/mlx4: Delete unwanted spaces behind usages of the sizeof operator SF Markus Elfring
2017-02-18 21:15 ` [PATCH 25/29] IB/mlx4: Add spaces for better code readability SF Markus Elfring
2017-02-18 21:16 ` [PATCH 26/29] IB/mlx4: Enclose 14 expressions for the sizeof operator by parentheses SF Markus Elfring
2017-02-18 21:17 ` [PATCH 27/29] IB/mlx5: Use kmalloc_array() in create_kernel_qp() SF Markus Elfring
2017-02-18 21:18 ` [PATCH 28/29] IB/mlx5: Less function calls in create_kernel_qp() after error detection SF Markus Elfring
2017-02-18 21:19 ` [PATCH 29/29] IB/mlx5: Use kmalloc_array() in create_srq_kernel() SF Markus Elfring
2017-04-20 20:37 ` [PATCH 00/29] IB/mlx: Fine-tuning for several function implementations Doug Ledford
2017-04-20 21:02   ` SF Markus Elfring
2017-04-21  2:23     ` Doug Ledford
2017-04-21 18:17   ` [PATCH v2 00/17] " SF Markus Elfring
2017-04-21 18:21     ` [PATCH v2 01/17] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() SF Markus Elfring
2017-04-21 18:24     ` [PATCH v2 02/17] IB/mlx: Use kmalloc_array() in six functions SF Markus Elfring
2017-04-21 18:28     ` [PATCH v2 03/17] IB/mlx4: Improve size determinations " SF Markus Elfring
2017-04-21 18:29     ` [PATCH v2 00/17] IB/mlx: Fine-tuning for several function implementations Bart Van Assche
2017-04-21 19:21       ` SF Markus Elfring
2017-04-21 19:55         ` Bart Van Assche
2017-04-21 18:30     ` [PATCH v2 04/17] IB/mlx4: Fix a typo in a comment line SF Markus Elfring
2017-04-21 18:33     ` [PATCH v2 05/17] IB/mlx4: Delete four unnecessary return statements SF Markus Elfring
2017-04-21 18:36     ` [PATCH v2 06/17] IB/mlx4: Delete an unnecessary check before kfree() in free_pv_object() SF Markus Elfring
2017-04-21 18:37     ` [PATCH v2 07/17] IB/mlx4: Move an assignment out of a check in forward_trap() SF Markus Elfring
2017-04-21 18:38     ` [PATCH v2 08/17] IB/mlx4: Enclose 46 expressions for sizeof by parentheses SF Markus Elfring
2017-04-21 18:40     ` [PATCH v2 09/17] IB/mlx4: Split a condition check in six functions SF Markus Elfring
2017-04-21 18:42     ` [PATCH v2 10/17] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() SF Markus Elfring
2017-04-21 18:44     ` [PATCH v2 11/17] IB/mlx4: Delete an unnecessary variable initialisation in mlx4_ib_add() SF Markus Elfring
2017-04-21 18:45     ` [PATCH v2 12/17] IB/mlx4: Delete an unnecessary variable assignment " SF Markus Elfring
2017-04-21 18:46     ` [PATCH v2 13/17] IB/mlx4: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-04-21 18:48     ` [PATCH v2 14/17] IB/mlx4: Delete unnecessary braces " SF Markus Elfring
2017-04-21 18:50     ` [PATCH v2 15/17] IB/mlx4: Delete unwanted spaces behind usages of the sizeof operator SF Markus Elfring
2017-04-21 18:54     ` [PATCH v2 16/17] IB/mlx4: Add spaces for better code readability SF Markus Elfring
2017-04-21 19:28       ` Joe Perches
2017-04-21 18:55     ` [PATCH v2 17/17] IB/mlx5: Less function calls in create_kernel_qp() after error detection SF Markus Elfring
2017-08-06 14:00     ` [PATCH v2 00/17] IB/mlx: Fine-tuning for several function implementations SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DC6B3471-8721-49CA-B2E3-CA883E60D341@mellanox.com \
    --to=majd@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=elfring@users.sourceforge.net \
    --cc=hal.rosenstock@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=sean.hefty@intel.com \
    --cc=yishaih@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).