diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2015-08-21 12:48:31 -0400 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2015-10-27 19:13:31 -0400 |
commit | 9d28cc811bbb43c7ca8dc8be375bab1e0efb037b (patch) | |
tree | 9cb238845d4856dec34f312209a1a802343a73c6 /arch/powerpc/sysdev/cpm_common.c | |
parent | 9100d20c5b6307bacd8756aba2f157cb1a8ffb56 (diff) |
powerpc: handle error case in cpm_muram_alloc()
rh_alloc() returns (unsigned long)-ERRxx on error, which may
result in overwriting memory outside the MURAM AREA.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'arch/powerpc/sysdev/cpm_common.c')
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index e2ea51961979..e00a5ee58fd7 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c | |||
@@ -147,7 +147,8 @@ unsigned long cpm_muram_alloc(unsigned long size, unsigned long align) | |||
147 | spin_lock_irqsave(&cpm_muram_lock, flags); | 147 | spin_lock_irqsave(&cpm_muram_lock, flags); |
148 | cpm_muram_info.alignment = align; | 148 | cpm_muram_info.alignment = align; |
149 | start = rh_alloc(&cpm_muram_info, size, "commproc"); | 149 | start = rh_alloc(&cpm_muram_info, size, "commproc"); |
150 | memset_io(cpm_muram_addr(start), 0, size); | 150 | if (!IS_ERR_VALUE(start)) |
151 | memset_io(cpm_muram_addr(start), 0, size); | ||
151 | spin_unlock_irqrestore(&cpm_muram_lock, flags); | 152 | spin_unlock_irqrestore(&cpm_muram_lock, flags); |
152 | 153 | ||
153 | return start; | 154 | return start; |