diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2017-08-27 11:06:50 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-14 09:53:03 +0100 |
commit | a724b569a50d2e94fd2d3ea123e1b5ad32293c61 (patch) | |
tree | dcb5dbdc290c969281395c0b305a1d7dbc7507d8 /drivers/bus | |
parent | 2ced9e2a850c40d3bfd7af4791f985318facff68 (diff) | |
download | linux-stable-a724b569a50d2e94fd2d3ea123e1b5ad32293c61.tar.gz linux-stable-a724b569a50d2e94fd2d3ea123e1b5ad32293c61.tar.bz2 linux-stable-a724b569a50d2e94fd2d3ea123e1b5ad32293c61.zip |
bus: arm-ccn: Check memory allocation failure
commit 24771179c5c138f0ea3ef88b7972979f62f2d5db upstream.
Check memory allocation failures and return -ENOMEM in such cases
This avoids a potential NULL pointer dereference.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/bus')
-rw-r--r-- | drivers/bus/arm-ccn.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c index e8c6946fed9d..be4bdead4075 100644 --- a/drivers/bus/arm-ccn.c +++ b/drivers/bus/arm-ccn.c @@ -1271,6 +1271,10 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) int len = snprintf(NULL, 0, "ccn_%d", ccn->dt.id); name = devm_kzalloc(ccn->dev, len + 1, GFP_KERNEL); + if (!name) { + err = -ENOMEM; + goto error_choose_name; + } snprintf(name, len + 1, "ccn_%d", ccn->dt.id); } @@ -1318,6 +1322,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) error_pmu_register: error_set_affinity: +error_choose_name: ida_simple_remove(&arm_ccn_pmu_ida, ccn->dt.id); for (i = 0; i < ccn->num_xps; i++) writel(0, ccn->xp[i].base + CCN_XP_DT_CONTROL); |