]> git.hungrycats.org Git - linux/commit
x86/pmem: Check for platform_device_alloc() retval
authorLi Jun <lijun01@kylinos.cn>
Tue, 2 Jun 2026 10:07:11 +0000 (18:07 +0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 4 Jun 2026 15:31:56 +0000 (08:31 -0700)
commit17b22e7a389e02e72912ab2904eac08da613c49e
tree92da70c18b8964c8d19a91395ea45cc3b1b17e33
parentd022ff2557accbc7e169e4812bd9899e7c77fb5c
x86/pmem: Check for platform_device_alloc() retval

Add proper error handling for the case when platform_device_alloc() returns
NULL due to memory allocation failure. This prevents a potential NULL pointer
dereference when trying to use the pdev pointer without checking if allocation
succeeded.

  [ bp: Massage commit message. ]

Signed-off-by: Li Jun <lijun01@kylinos.cn>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260602100711.2542568-1-lijun01@kylinos.cn
arch/x86/kernel/pmem.c