aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJitendra Kolhe <jitendra.kolhe@hpe.com>2017-03-21 02:50:06 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2017-03-24 11:50:11 +0100
commitdfd0dcc71724b11e125f67c8710c50c41da6ee4a (patch)
tree3b04f7c11560309afd136408fc20be996f24f18a /include
parent30663fd26c0307e414622c7a8607fbc04f92ec14 (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 'include')
0 files changed, 0 insertions, 0 deletions