Source
419
419
for (count = 0; *t; t++, count++)
420
420
;
421
421
422
422
if (count == 0)
423
423
return ERR_PTR(-EINVAL);
424
424
425
425
group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL);
426
426
if (group == NULL)
427
427
return ERR_PTR(-ENOMEM);
428
428
429
-
attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1),
429
+
attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs),
430
430
GFP_KERNEL);
431
431
if (attrs == NULL)
432
432
return ERR_PTR(-ENOMEM);
433
433
434
-
su = devm_kzalloc(dev, sizeof(*su) * repeat * count,
434
+
su = devm_kzalloc(dev, array3_size(repeat, count, sizeof(*su)),
435
435
GFP_KERNEL);
436
436
if (su == NULL)
437
437
return ERR_PTR(-ENOMEM);
438
438
439
439
group->attrs = attrs;
440
440
group->is_visible = tg->is_visible;
441
441
442
442
for (i = 0; i < repeat; i++) {
443
443
t = tg->templates;
444
444
for (j = 0; *t != NULL; j++) {