]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/ipoib: Fix use of sizeof()
authorKamal Heib <kamalheib1@gmail.com>
Wed, 4 Jul 2018 21:52:51 +0000 (00:52 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 9 Jul 2018 18:02:42 +0000 (12:02 -0600)
Make sure to use sizeof(...) instead of sizeof ... which is more
preferred.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/ulp/ipoib/ipoib_cm.c
drivers/infiniband/ulp/ipoib/ipoib_fs.c
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/infiniband/ulp/ipoib/ipoib_verbs.c
drivers/infiniband/ulp/ipoib/ipoib_vlan.c

index 9b374ce354b487bb9d46c1bc1e1962e33a9d2eed..582f199887b0d54f9e27b61b78c911fc99e79a89 100644 (file)
@@ -363,7 +363,7 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i
        if (!rx->rx_ring)
                return -ENOMEM;
 
-       t = kmalloc(sizeof *t, GFP_KERNEL);
+       t = kmalloc(sizeof(*t), GFP_KERNEL);
        if (!t) {
                ret = -ENOMEM;
                goto err_free_1;
@@ -432,7 +432,7 @@ static int ipoib_cm_send_rep(struct net_device *dev, struct ib_cm_id *cm_id,
        data.mtu = cpu_to_be32(IPOIB_CM_BUF_SIZE);
 
        rep.private_data = &data;
-       rep.private_data_len = sizeof data;
+       rep.private_data_len = sizeof(data);
        rep.flow_control = 0;
        rep.rnr_retry_count = req->rnr_retry_count;
        rep.srq = ipoib_cm_has_srq(dev);
@@ -450,7 +450,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
        int ret;
 
        ipoib_dbg(priv, "REQ arrived\n");
-       p = kzalloc(sizeof *p, GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (!p)
                return -ENOMEM;
        p->dev = dev;
@@ -658,7 +658,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
        }
 
        ipoib_cm_dma_unmap_rx(priv, frags, rx_ring[wr_id].mapping);
-       memcpy(rx_ring[wr_id].mapping, mapping, (frags + 1) * sizeof *mapping);
+       memcpy(rx_ring[wr_id].mapping, mapping, (frags + 1) * sizeof(*mapping));
 
        ipoib_dbg_data(priv, "received %d bytes, SLID 0x%04x\n",
                       wc->byte_len, wc->slid);
@@ -1095,7 +1095,7 @@ static int ipoib_cm_send_req(struct net_device *dev,
        req.qp_num                      = qp->qp_num;
        req.qp_type                     = qp->qp_type;
        req.private_data                = &data;
-       req.private_data_len            = sizeof data;
+       req.private_data_len            = sizeof(data);
        req.flow_control                = 0;
 
        req.starting_psn                = 0; /* FIXME */
@@ -1153,7 +1153,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
                ret = -ENOMEM;
                goto err_tx;
        }
-       memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring);
+       memset(p->tx_ring, 0, ipoib_sendq_size * sizeof(*p->tx_ring));
 
        p->qp = ipoib_cm_create_tx_qp(p->dev, p);
        memalloc_noio_restore(noio_flag);
@@ -1306,7 +1306,7 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path
        struct ipoib_dev_priv *priv = ipoib_priv(dev);
        struct ipoib_cm_tx *tx;
 
-       tx = kzalloc(sizeof *tx, GFP_ATOMIC);
+       tx = kzalloc(sizeof(*tx), GFP_ATOMIC);
        if (!tx)
                return NULL;
 
@@ -1371,7 +1371,7 @@ static void ipoib_cm_tx_start(struct work_struct *work)
                                neigh->daddr + QPN_AND_OPTIONS_OFFSET);
                        goto free_neigh;
                }
-               memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);
+               memcpy(&pathrec, &p->path->pathrec, sizeof(pathrec));
 
                spin_unlock_irqrestore(&priv->lock, flags);
                netif_tx_unlock_bh(dev);
index ea302b0546016886e691fdaa38d85051ba36f23f..178488028734bb08a60a3af24f86e5a409a42af5 100644 (file)
@@ -262,15 +262,15 @@ static const struct file_operations ipoib_path_fops = {
 void ipoib_create_debug_files(struct net_device *dev)
 {
        struct ipoib_dev_priv *priv = ipoib_priv(dev);
-       char name[IFNAMSIZ + sizeof "_path"];
+       char name[IFNAMSIZ + sizeof("_path")];
 
-       snprintf(name, sizeof name, "%s_mcg", dev->name);
+       snprintf(name, sizeof(name), "%s_mcg", dev->name);
        priv->mcg_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO,
                                               ipoib_root, dev, &ipoib_mcg_fops);
        if (!priv->mcg_dentry)
                ipoib_warn(priv, "failed to create mcg debug file\n");
 
-       snprintf(name, sizeof name, "%s_path", dev->name);
+       snprintf(name, sizeof(name), "%s_path", dev->name);
        priv->path_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO,
                                                ipoib_root, dev, &ipoib_path_fops);
        if (!priv->path_dentry)
index f782f4b025694442616098d22db180f5f4c13c0c..5f5d42bad2ea96bbe2f95213f975c0870c45910a 100644 (file)
@@ -58,7 +58,7 @@ struct ipoib_ah *ipoib_create_ah(struct net_device *dev,
        struct ipoib_ah *ah;
        struct ib_ah *vah;
 
-       ah = kmalloc(sizeof *ah, GFP_KERNEL);
+       ah = kmalloc(sizeof(*ah), GFP_KERNEL);
        if (!ah)
                return ERR_PTR(-ENOMEM);
 
@@ -203,7 +203,7 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
        }
 
        memcpy(mapping, priv->rx_ring[wr_id].mapping,
-              IPOIB_UD_RX_SG * sizeof *mapping);
+              IPOIB_UD_RX_SG * sizeof(*mapping));
 
        /*
         * If we can't allocate a new RX buffer, dump
index 15344f91d96b70cec76df2a63881e518238e5499..9bcd487e51c29a6e05285a03a99be197fd12fd37 100644 (file)
@@ -634,7 +634,7 @@ struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev)
 {
        struct ipoib_path_iter *iter;
 
-       iter = kmalloc(sizeof *iter, GFP_KERNEL);
+       iter = kmalloc(sizeof(*iter), GFP_KERNEL);
        if (!iter)
                return NULL;
 
@@ -885,7 +885,7 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
        if (!priv->broadcast)
                return NULL;
 
-       path = kzalloc(sizeof *path, GFP_ATOMIC);
+       path = kzalloc(sizeof(*path), GFP_ATOMIC);
        if (!path)
                return NULL;
 
@@ -1207,7 +1207,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
 {
        struct ipoib_header *header;
 
-       header = skb_push(skb, sizeof *header);
+       header = skb_push(skb, sizeof(*header));
 
        header->proto = htons(type);
        header->reserved = 0;
@@ -1375,7 +1375,7 @@ static struct ipoib_neigh *ipoib_neigh_ctor(u8 *daddr,
 {
        struct ipoib_neigh *neigh;
 
-       neigh = kzalloc(sizeof *neigh, GFP_ATOMIC);
+       neigh = kzalloc(sizeof(*neigh), GFP_ATOMIC);
        if (!neigh)
                return NULL;
 
@@ -2366,7 +2366,7 @@ static void ipoib_add_one(struct ib_device *device)
        int p;
        int count = 0;
 
-       dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
+       dev_list = kmalloc(sizeof(*dev_list), GFP_KERNEL);
        if (!dev_list)
                return;
 
index 6709328d90f8b43c6b94e1f816ed611a25c6ea19..f696ea49c97a40e934758a66c481f6d4ad000045 100644 (file)
@@ -140,7 +140,7 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev,
 {
        struct ipoib_mcast *mcast;
 
-       mcast = kzalloc(sizeof *mcast, can_sleep ? GFP_KERNEL : GFP_ATOMIC);
+       mcast = kzalloc(sizeof(*mcast), can_sleep ? GFP_KERNEL : GFP_ATOMIC);
        if (!mcast)
                return NULL;
 
@@ -917,7 +917,7 @@ void ipoib_mcast_restart_task(struct work_struct *work)
                if (!ipoib_mcast_addr_is_valid(ha->addr, dev->broadcast))
                        continue;
 
-               memcpy(mgid.raw, ha->addr + 4, sizeof mgid);
+               memcpy(mgid.raw, ha->addr + 4, sizeof(mgid));
 
                mcast = __ipoib_mcast_find(dev, &mgid);
                if (!mcast || test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) {
@@ -997,7 +997,7 @@ struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev)
 {
        struct ipoib_mcast_iter *iter;
 
-       iter = kmalloc(sizeof *iter, GFP_KERNEL);
+       iter = kmalloc(sizeof(*iter), GFP_KERNEL);
        if (!iter)
                return NULL;
 
index ba4669f24014d490b9a5b43c446dd90b7798fe38..8dbf305508a01967828dff996e9150aa15d9dbcc 100644 (file)
@@ -52,7 +52,7 @@ int ipoib_mcast_attach(struct net_device *dev, struct ib_device *hca,
 
        if (set_qkey) {
                ret = -ENOMEM;
-               qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
+               qp_attr = kmalloc(sizeof(*qp_attr), GFP_KERNEL);
                if (!qp_attr)
                        goto out;
 
index 55a9b71ed05a7ff8ff0ac9f7eb84af1d4f6476a0..b067ad5e4c7e595795fa6bbdbc2d99d04e27d45f 100644 (file)
@@ -130,7 +130,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
        if (test_bit(IPOIB_FLAG_GOING_DOWN, &ppriv->flags))
                return -EPERM;
 
-       snprintf(intf_name, sizeof intf_name, "%s.%04x",
+       snprintf(intf_name, sizeof(intf_name), "%s.%04x",
                 ppriv->dev->name, pkey);
 
        if (!mutex_trylock(&ppriv->sysfs_mutex))