aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2014-01-12 18:50:45 +0000
committerHauke Mehrtens <hauke@openwrt.org>2014-01-12 18:50:45 +0000
commitb26aeffe76854b683b28273108c97d560138cef7 (patch)
treee9b37577fc52e745c79274ae458da97281b9c854 /target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch
parentefd0e137a75a29619b8121fe8266267f4a1ea195 (diff)
downloadmaster-187ad058-b26aeffe76854b683b28273108c97d560138cef7.tar.gz
master-187ad058-b26aeffe76854b683b28273108c97d560138cef7.tar.bz2
master-187ad058-b26aeffe76854b683b28273108c97d560138cef7.zip
brcm47xx: update mtd drivers
This backports some patches from linux upstream. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39249 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch b/target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch
new file mode 100644
index 0000000000..ad24b5993d
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.10/020-mtd-bcm47xxpart-handle-malloc-failures.patch
@@ -0,0 +1,30 @@
+From 99b1d1887fee36ef9ff5d2ee24f0cf3e8c172104 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 13 Oct 2013 22:53:49 +0200
+Subject: [PATCH] mtd: bcm47xxpart: handle malloc failures
+
+Handle return NULL in malloc.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+---
+ drivers/mtd/bcm47xxpart.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/mtd/bcm47xxpart.c
++++ b/drivers/mtd/bcm47xxpart.c
+@@ -71,7 +71,14 @@ static int bcm47xxpart_parse(struct mtd_
+ /* Alloc */
+ parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
+ GFP_KERNEL);
++ if (!parts)
++ return -ENOMEM;
++
+ buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL);
++ if (!buf) {
++ kfree(parts);
++ return -ENOMEM;
++ }
+
+ /* Parse block by block looking for magics */
+ for (offset = 0; offset <= master->size - blocksize;