linux-kernelorg-stable/tools/testing/nvdimm
Guangshuo Li a9e6aa9949 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: 9399ab61ad ("ndtest: Add dimms to the two buses")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
2025-09-25 12:49:46 -05:00
..
test nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe() 2025-09-25 12:49:46 -05:00
Kbuild tools/testing/nvdimm: Disable "missing prototypes / declarations" warnings 2024-01-22 10:41:59 -08:00
Makefile
acpi_nfit_test.c
config_check.c
dax-dev.c
dax_pmem_test.c
device_dax_test.c
libnvdimm_test.c
pmem-dax.c mm: remove callers of pfn_t functionality 2025-07-09 22:42:19 -07:00
pmem_test.c
watermark.h