Calling readdir() with NULL dirp leads to segfault. Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx> --- tools/kvm/kvm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index cd3cb19..2ac7b38 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -172,7 +172,7 @@ int kvm__enumerate_instances(void (*callback)(const char *name, int pid)) sprintf(full_name, "%s/%s", HOME_DIR, KVM_PID_FILE_PATH); dir = opendir(full_name); - for (;;) { + for (;dir;) { readdir_r(dir, &entry, &result); if (result == NULL) break; -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html