summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson2019-01-13 07:03:18 +0100
committerOlof Johansson2019-01-13 07:03:18 +0100
commit2ec472edcd72947b031ec998d646dd7a6be958dd (patch)
tree32c5caf8f6734f1ce5e5813122aa242377a78670
parentMerge tag 'amlogic-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/... (diff)
parentARM: integrator: impd1: use struct_size() in devm_kzalloc() (diff)
downloadkernel-qcow2-linux-2ec472edcd72947b031ec998d646dd7a6be958dd.tar.gz
kernel-qcow2-linux-2ec472edcd72947b031ec998d646dd7a6be958dd.tar.xz
kernel-qcow2-linux-2ec472edcd72947b031ec998d646dd7a6be958dd.zip
Merge tag 'integrator-fixes-armsoc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator into fixes
Fixes for the Integrator: - Handle failed allocations in the IM/PC bus attachment. - Use struct_size() for allocation. * tag 'integrator-fixes-armsoc' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator: ARM: integrator: impd1: use struct_size() in devm_kzalloc() gpio: pl061: handle failed allocations Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--arch/arm/mach-integrator/impd1.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index a109f6482413..8dfad012dfae 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -390,10 +390,14 @@ static int __ref impd1_probe(struct lm_device *dev)
char *mmciname;
lookup = devm_kzalloc(&dev->dev,
- sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup),
+ struct_size(lookup, table, 3),
GFP_KERNEL);
chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL);
- mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id);
+ mmciname = devm_kasprintf(&dev->dev, GFP_KERNEL,
+ "lm%x:00700", dev->id);
+ if (!lookup || !chipname || !mmciname)
+ return -ENOMEM;
+
lookup->dev_id = mmciname;
/*
* Offsets on GPIO block 1: