mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 12:37:32 +00:00
bus: arm-ccn: Check memory allocation failure
commit 24771179c5
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>
This commit is contained in:
parent
2ced9e2a85
commit
a724b569a5
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue