Patch "ptp: use kcalloc when allocating arrays" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ptp: use kcalloc when allocating arrays

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ptp-use-kcalloc-when-allocating-arrays.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 6f7aa56bae6ff38727d5c8bf6ee7d4202b4e3865 Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Date: Tue, 14 Feb 2017 10:23:32 -0800
Subject: ptp: use kcalloc when allocating arrays

From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>

commit 6f7aa56bae6ff38727d5c8bf6ee7d4202b4e3865 upstream.

kcalloc is more semantically correct when allocating arrays of objects, and
overflow-safe.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 drivers/ptp/ptp_sysfs.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -269,13 +269,12 @@ static int ptp_populate_pins(struct ptp_
 	struct ptp_clock_info *info = ptp->info;
 	int err = -ENOMEM, i, n_pins = info->n_pins;
 
-	ptp->pin_dev_attr = kzalloc(n_pins * sizeof(*ptp->pin_dev_attr),
+	ptp->pin_dev_attr = kcalloc(n_pins, sizeof(*ptp->pin_dev_attr),
 				    GFP_KERNEL);
 	if (!ptp->pin_dev_attr)
 		goto no_dev_attr;
 
-	ptp->pin_attr = kzalloc((1 + n_pins) * sizeof(struct attribute *),
-				GFP_KERNEL);
+	ptp->pin_attr = kcalloc(1 + n_pins, sizeof(*ptp->pin_attr), GFP_KERNEL);
 	if (!ptp->pin_attr)
 		goto no_pin_attr;
 


Patches currently in stable-queue which might be from dmitry.torokhov@xxxxxxxxx are

queue-4.9/ptp-use-kcalloc-when-allocating-arrays.patch
queue-4.9/ptp-do-not-explicitly-set-drvdata-in-ptp_clock_register.patch
queue-4.9/input-atmel_mxt_ts-disable-irq-across-suspend.patch
queue-4.9/ptp-use-is_visible-method-to-hide-unused-attributes.patch
queue-4.9/ptp-create-pins-together-with-the-rest-of-attributes.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux