diff options
| author | Kunwu Chan <chentao@kylinos.cn> | 2023-11-22 06:06:51 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-08-29 18:30:33 +0300 |
| commit | 2cb514b5ae883d41d945bba1022700f7823cb9a3 (patch) | |
| tree | 550aea6fbac1b3dd0a18db5d1ca3adf5d540e9c1 /arch/powerpc/sysdev/xics | |
| parent | 73535c8d819d73383c06b86530203d1ff89b2969 (diff) | |
| download | linux-2cb514b5ae883d41d945bba1022700f7823cb9a3.tar.xz | |
powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu
[ Upstream commit 45b1ba7e5d1f6881050d558baf9bc74a2ae13930 ]
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231122030651.3818-1-chentao@kylinos.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/powerpc/sysdev/xics')
| -rw-r--r-- | arch/powerpc/sysdev/xics/icp-native.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c index edc17b6b1cc2..9b2238d73003 100644 --- a/arch/powerpc/sysdev/xics/icp-native.c +++ b/arch/powerpc/sysdev/xics/icp-native.c @@ -236,6 +236,8 @@ static int __init icp_native_map_one_cpu(int hw_id, unsigned long addr, rname = kasprintf(GFP_KERNEL, "CPU %d [0x%x] Interrupt Presentation", cpu, hw_id); + if (!rname) + return -ENOMEM; if (!request_mem_region(addr, size, rname)) { pr_warn("icp_native: Could not reserve ICP MMIO for CPU %d, interrupt server #0x%x\n", cpu, hw_id); |
