Re: [PATCH 2/5] IB/qib: Use kmalloc_array() in qib_init_7322_variables()
On Wed, Apr 05, 2017 at 03:52:48PM +0200, SF Markus Elfring wrote: > From: Markus Elfring> Date: Wed, 5 Apr 2017 09:51:33 +0200 > > Multiplications for the size determination of memory allocations > indicated that array data structures should be processed. > Thus use the corresponding function "kmalloc_array". > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/infiniband/hw/qib/qib_iba7322.c | 15 +-- > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c > b/drivers/infiniband/hw/qib/qib_iba7322.c > index e4e4e675c89c..490f432809b8 100644 > --- a/drivers/infiniband/hw/qib/qib_iba7322.c > +++ b/drivers/infiniband/hw/qib/qib_iba7322.c > @@ -6442,12 +6442,15 @@ static int qib_init_7322_variables(struct qib_devdata > *dd) > sbufcnt = dd->piobcnt2k + dd->piobcnt4k + > NUM_VL15_BUFS + BITS_PER_LONG - 1; > sbufcnt /= BITS_PER_LONG; > - dd->cspec->sendchkenable = kmalloc(sbufcnt * > - sizeof(*dd->cspec->sendchkenable), GFP_KERNEL); > - dd->cspec->sendgrhchk = kmalloc(sbufcnt * > - sizeof(*dd->cspec->sendgrhchk), GFP_KERNEL); > - dd->cspec->sendibchk = kmalloc(sbufcnt * > - sizeof(*dd->cspec->sendibchk), GFP_KERNEL); > + dd->cspec->sendchkenable = kmalloc_array(sbufcnt, > + > sizeof(*dd->cspec->sendchkenable), > + GFP_KERNEL); > + dd->cspec->sendgrhchk = kmalloc_array(sbufcnt, > + sizeof(*dd->cspec->sendgrhchk), > + GFP_KERNEL); > + dd->cspec->sendibchk = kmalloc_array(sbufcnt, > + sizeof(*dd->cspec->sendibchk), > + GFP_KERNEL); > if (!dd->cspec->sendchkenable || !dd->cspec->sendgrhchk || > !dd->cspec->sendibchk) { > ret = -ENOMEM; Reviewed-by: Yuval Shaia > -- > 2.12.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/5] IB/qib: Use kmalloc_array() in qib_init_7322_variables()
On Wed, Apr 05, 2017 at 03:52:48PM +0200, SF Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 5 Apr 2017 09:51:33 +0200 > > Multiplications for the size determination of memory allocations > indicated that array data structures should be processed. > Thus use the corresponding function "kmalloc_array". > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/infiniband/hw/qib/qib_iba7322.c | 15 +-- > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c > b/drivers/infiniband/hw/qib/qib_iba7322.c > index e4e4e675c89c..490f432809b8 100644 > --- a/drivers/infiniband/hw/qib/qib_iba7322.c > +++ b/drivers/infiniband/hw/qib/qib_iba7322.c > @@ -6442,12 +6442,15 @@ static int qib_init_7322_variables(struct qib_devdata > *dd) > sbufcnt = dd->piobcnt2k + dd->piobcnt4k + > NUM_VL15_BUFS + BITS_PER_LONG - 1; > sbufcnt /= BITS_PER_LONG; > - dd->cspec->sendchkenable = kmalloc(sbufcnt * > - sizeof(*dd->cspec->sendchkenable), GFP_KERNEL); > - dd->cspec->sendgrhchk = kmalloc(sbufcnt * > - sizeof(*dd->cspec->sendgrhchk), GFP_KERNEL); > - dd->cspec->sendibchk = kmalloc(sbufcnt * > - sizeof(*dd->cspec->sendibchk), GFP_KERNEL); > + dd->cspec->sendchkenable = kmalloc_array(sbufcnt, > + > sizeof(*dd->cspec->sendchkenable), > + GFP_KERNEL); > + dd->cspec->sendgrhchk = kmalloc_array(sbufcnt, > + sizeof(*dd->cspec->sendgrhchk), > + GFP_KERNEL); > + dd->cspec->sendibchk = kmalloc_array(sbufcnt, > + sizeof(*dd->cspec->sendibchk), > + GFP_KERNEL); > if (!dd->cspec->sendchkenable || !dd->cspec->sendgrhchk || > !dd->cspec->sendibchk) { > ret = -ENOMEM; Reviewed-by: Yuval Shaia > -- > 2.12.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] IB/qib: Use kmalloc_array() in qib_init_7322_variables()
From: Markus ElfringDate: Wed, 5 Apr 2017 09:51:33 +0200 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/qib/qib_iba7322.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index e4e4e675c89c..490f432809b8 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c @@ -6442,12 +6442,15 @@ static int qib_init_7322_variables(struct qib_devdata *dd) sbufcnt = dd->piobcnt2k + dd->piobcnt4k + NUM_VL15_BUFS + BITS_PER_LONG - 1; sbufcnt /= BITS_PER_LONG; - dd->cspec->sendchkenable = kmalloc(sbufcnt * - sizeof(*dd->cspec->sendchkenable), GFP_KERNEL); - dd->cspec->sendgrhchk = kmalloc(sbufcnt * - sizeof(*dd->cspec->sendgrhchk), GFP_KERNEL); - dd->cspec->sendibchk = kmalloc(sbufcnt * - sizeof(*dd->cspec->sendibchk), GFP_KERNEL); + dd->cspec->sendchkenable = kmalloc_array(sbufcnt, + sizeof(*dd->cspec->sendchkenable), +GFP_KERNEL); + dd->cspec->sendgrhchk = kmalloc_array(sbufcnt, + sizeof(*dd->cspec->sendgrhchk), + GFP_KERNEL); + dd->cspec->sendibchk = kmalloc_array(sbufcnt, +sizeof(*dd->cspec->sendibchk), +GFP_KERNEL); if (!dd->cspec->sendchkenable || !dd->cspec->sendgrhchk || !dd->cspec->sendibchk) { ret = -ENOMEM; -- 2.12.2
[PATCH 2/5] IB/qib: Use kmalloc_array() in qib_init_7322_variables()
From: Markus Elfring Date: Wed, 5 Apr 2017 09:51:33 +0200 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/qib/qib_iba7322.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index e4e4e675c89c..490f432809b8 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c @@ -6442,12 +6442,15 @@ static int qib_init_7322_variables(struct qib_devdata *dd) sbufcnt = dd->piobcnt2k + dd->piobcnt4k + NUM_VL15_BUFS + BITS_PER_LONG - 1; sbufcnt /= BITS_PER_LONG; - dd->cspec->sendchkenable = kmalloc(sbufcnt * - sizeof(*dd->cspec->sendchkenable), GFP_KERNEL); - dd->cspec->sendgrhchk = kmalloc(sbufcnt * - sizeof(*dd->cspec->sendgrhchk), GFP_KERNEL); - dd->cspec->sendibchk = kmalloc(sbufcnt * - sizeof(*dd->cspec->sendibchk), GFP_KERNEL); + dd->cspec->sendchkenable = kmalloc_array(sbufcnt, + sizeof(*dd->cspec->sendchkenable), +GFP_KERNEL); + dd->cspec->sendgrhchk = kmalloc_array(sbufcnt, + sizeof(*dd->cspec->sendgrhchk), + GFP_KERNEL); + dd->cspec->sendibchk = kmalloc_array(sbufcnt, +sizeof(*dd->cspec->sendibchk), +GFP_KERNEL); if (!dd->cspec->sendchkenable || !dd->cspec->sendgrhchk || !dd->cspec->sendibchk) { ret = -ENOMEM; -- 2.12.2