diff options
author | Jitendra Kolhe <jitendra.kolhe@hpe.com> | 2017-03-21 02:50:06 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-03-24 11:50:11 +0100 |
commit | dfd0dcc71724b11e125f67c8710c50c41da6ee4a (patch) | |
tree | 3b04f7c11560309afd136408fc20be996f24f18a /util/qemu-thread-win32.c | |
parent | 30663fd26c0307e414622c7a8607fbc04f92ec14 (diff) |
mem-prealloc: fix sysconf(_SC_NPROCESSORS_ONLN) failure case.
This was spotted by Coverity, in case where sysconf(_SC_NPROCESSORS_ONLN)
fails and returns -1. This results in memset_num_threads getting set to -1.
Which we then pass to g_new0().
The patch replaces MAX_MEM_PREALLOC_THREAD_COUNT macro with a function call
get_memset_num_threads() to handle sysconf() failure gracefully. In case
sysconf() fails, we fall back to single threaded.
(Spotted by Coverity, CID 1372465.)
Signed-off-by: Jitendra Kolhe <jitendra.kolhe@hpe.com>
Message-Id: <1490079006-32495-1-git-send-email-jitendra.kolhe@hpe.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/qemu-thread-win32.c')
0 files changed, 0 insertions, 0 deletions