]> Git Repo - qemu.git/commit
mem-prealloc: fix sysconf(_SC_NPROCESSORS_ONLN) failure case.
authorJitendra Kolhe <[email protected]>
Tue, 21 Mar 2017 06:50:06 +0000 (02:50 -0400)
committerPaolo Bonzini <[email protected]>
Fri, 24 Mar 2017 10:50:11 +0000 (11:50 +0100)
commitdfd0dcc71724b11e125f67c8710c50c41da6ee4a
tree3b04f7c11560309afd136408fc20be996f24f18a
parent30663fd26c0307e414622c7a8607fbc04f92ec14
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 <[email protected]>
Message-Id: <1490079006[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
util/oslib-posix.c
This page took 0.023875 seconds and 4 git commands to generate.