diff options
author | Dmitry Frolov <frolov@swemel.ru> | 2023-10-10 13:48:53 +0300 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-10-17 09:14:32 +0200 |
commit | f75ed59f40bed3ce94adad4b3ebbb7bfacfdf4ab (patch) | |
tree | dc94543f961b774fd08a9b94cbc078b47e239881 /migration/ram.c | |
parent | 8b2395970aa3beab91b98dda89c7ed471e65ad25 (diff) | |
download | qemu-f75ed59f40bed3ce94adad4b3ebbb7bfacfdf4ab.zip qemu-f75ed59f40bed3ce94adad4b3ebbb7bfacfdf4ab.tar.gz qemu-f75ed59f40bed3ce94adad4b3ebbb7bfacfdf4ab.tar.bz2 |
migration: fix RAMBlock add NULL check
qemu_ram_block_from_host() may return NULL, which will be dereferenced w/o
check. Usualy return value is checked for this function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231010104851.802947-1-frolov@swemel.ru>
Diffstat (limited to 'migration/ram.c')
-rw-r--r-- | migration/ram.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/migration/ram.c b/migration/ram.c index 24d91de..e8df4dc 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4285,6 +4285,11 @@ static void ram_mig_ram_block_resized(RAMBlockNotifier *n, void *host, RAMBlock *rb = qemu_ram_block_from_host(host, false, &offset); Error *err = NULL; + if (!rb) { + error_report("RAM block not found"); + return; + } + if (migrate_ram_is_ignored(rb)) { return; } |