]> git.proxmox.com Git - mirror_qemu.git/commit - softmmu/physmem.c
softmmu/physmem.c: Check return value from realpath()
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 12 Aug 2021 15:15:25 +0000 (16:15 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 26 Aug 2021 16:02:00 +0000 (17:02 +0100)
commit8efdb7ba1b2acce9fb63ccc2e7982e19fdf5be86
tree190bb5a8afdc8149786992b58ce95ef9a3b0f40e
parent8f1bdb0ea136c38cf963f5fafff103e1b6fb488d
softmmu/physmem.c: Check return value from realpath()

The realpath() function can return NULL on error, so we need to check
for it to avoid crashing when we try to strstr() into it.
This can happen if we run out of memory, or if /sys/ is not mounted,
among other situations.

Fixes: Coverity 1459913, 1460474
Fixes: ce317be98db0 ("exec: fetch the alignment of Linux devdax pmem character device nodes")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Jingqi Liu <jingqi.liu@intel.com>
Message-id: 20210812151525.31456-1-peter.maydell@linaro.org
softmmu/physmem.c