Commit a9e6aa99 authored by Guangshuo Li's avatar Guangshuo Li Committed by Ira Weiny
Browse files

nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe()



devm_kcalloc() may fail. ndtest_probe() allocates three DMA address
arrays (dcr_dma, label_dma, dimm_dma) and later unconditionally uses
them in ndtest_nvdimm_init(), which can lead to a NULL pointer
dereference under low-memory conditions.

Check all three allocations and return -ENOMEM if any allocation fails,
jumping to the common error path. Do not emit an extra error message
since the allocator already warns on allocation failure.

Fixes: 9399ab61 ("ndtest: Add dimms to the two buses")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarGuangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: default avatarAlison Schofield <alison.schofield@intel.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
parent 88506435
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment