[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/37] softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_a
From: |
Peter Maydell |
Subject: |
[PULL 24/37] softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd() |
Date: |
Thu, 26 Aug 2021 18:02:54 +0100 |
In the alignment check added to qemu_ram_alloc_from_fd() in commit
ce317be98db0dfdfa, the condition includes a check that 'mr' is not
NULL. This check is unnecessary because we can assume that the
caller always passes us a valid MemoryRegion, and indeed later in the
function we assume mr is not NULL when we pass it to file_ram_alloc()
as new_block->mr. Remove it.
Fixes: Coverity 1459867
Fixes: ce317be98d ("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: 20210812150624.29139-1-peter.maydell@linaro.org
---
softmmu/physmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 2e18947598e..31baf3a8877 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2075,7 +2075,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size,
MemoryRegion *mr,
}
file_align = get_file_align(fd);
- if (file_align > 0 && mr && file_align > mr->align) {
+ if (file_align > 0 && file_align > mr->align) {
error_setg(errp, "backing store align 0x%" PRIx64
" is larger than 'align' option 0x%" PRIx64,
file_align, mr->align);
--
2.20.1
- [PULL 14/37] MAINTAINERS: Add ACPI specs documents to ACPI and NVDIMM sections, (continued)
- [PULL 14/37] MAINTAINERS: Add ACPI specs documents to ACPI and NVDIMM sections, Peter Maydell, 2021/08/26
- [PULL 13/37] docs/specs/acpi_nvdimm: Convert to rST, Peter Maydell, 2021/08/26
- [PULL 11/37] docs/specs/acpi_mem_hotplug: Convert to rST, Peter Maydell, 2021/08/26
- [PULL 16/37] monitor: Use accel_find("kvm") instead of kvm_available(), Peter Maydell, 2021/08/26
- [PULL 17/37] softmmu/arch_init.c: Trim down include list, Peter Maydell, 2021/08/26
- [PULL 19/37] arch_init.h: Add QEMU_ARCH_HEXAGON, Peter Maydell, 2021/08/26
- [PULL 20/37] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c, Peter Maydell, 2021/08/26
- [PULL 18/37] meson.build: Define QEMU_ARCH in config-target.h, Peter Maydell, 2021/08/26
- [PULL 22/37] stubs: Remove unused arch_type.c stub, Peter Maydell, 2021/08/26
- [PULL 21/37] arch_init.h: Don't include arch_init.h unnecessarily, Peter Maydell, 2021/08/26
- [PULL 24/37] softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd(),
Peter Maydell <=
- [PULL 23/37] hw/core/loader: In gunzip(), check index is in range before use, not after, Peter Maydell, 2021/08/26
- [PULL 26/37] net: Zero sockaddr_in in parse_host_port(), Peter Maydell, 2021/08/26
- [PULL 30/37] raspi: Use error_fatal for SoC realize errors, not error_abort, Peter Maydell, 2021/08/26
- [PULL 28/37] tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct, Peter Maydell, 2021/08/26
- [PULL 32/37] hw/arm/virt: Delete EL3 error checksnow provided in CPU realize, Peter Maydell, 2021/08/26
- [PULL 27/37] gdbstub: Zero-initialize sockaddr structs, Peter Maydell, 2021/08/26
- [PULL 29/37] tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs, Peter Maydell, 2021/08/26
- [PULL 25/37] softmmu/physmem.c: Check return value from realpath(), Peter Maydell, 2021/08/26
- [PULL 33/37] target/arm: Implement HSTR.TTEE, Peter Maydell, 2021/08/26
- [PULL 36/37] hw/arm/xlnx-versal: Add unimplemented APU mmio, Peter Maydell, 2021/08/26