The advantage of kcalloc is, that will prevent integer overflows which
could result from the multiplication of number of elements and size and
it is also a bit nicer to read.
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
         * Allocate full portcnt array, rather than just cfgports, because
         * cleanup iterates across all possible ports.
         */
-       dd->ipath_pd = kzalloc(sizeof(*dd->ipath_pd) * dd->ipath_portcnt,
+       dd->ipath_pd = kcalloc(dd->ipath_portcnt, sizeof(*dd->ipath_pd),
                               GFP_KERNEL);
 
        if (!dd->ipath_pd) {
 
        idev->qp_table.last = 1;        /* QPN 0 and 1 are special. */
        idev->qp_table.max = size;
        idev->qp_table.nmaps = 1;
-       idev->qp_table.table = kzalloc(size * sizeof(*idev->qp_table.table),
+       idev->qp_table.table = kcalloc(size, sizeof(*idev->qp_table.table),
                                       GFP_KERNEL);
        if (idev->qp_table.table == NULL) {
                ret = -ENOMEM;
 
         * the LKEY).  The remaining bits act as a generation number or tag.
         */
        idev->lk_table.max = 1 << ib_ipath_lkey_table_size;
-       idev->lk_table.table = kzalloc(idev->lk_table.max *
+       idev->lk_table.table = kcalloc(idev->lk_table.max,
                                       sizeof(*idev->lk_table.table),
                                       GFP_KERNEL);
        if (idev->lk_table.table == NULL) {