Patch "selftests: kvm: fix mismatched fclose() after popen()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests: kvm: fix mismatched fclose() after popen()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-kvm-fix-mismatched-fclose-after-popen.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 391e3e0d3f1f9b6f87601a76bc09d8f739e87799
Author: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
Date:   Thu Oct 21 11:56:03 2021 -0600

    selftests: kvm: fix mismatched fclose() after popen()
    
    [ Upstream commit c3867ab5924b7a9a0b4a117902a08669d8be7c21 ]
    
    get_warnings_count() does fclose() using File * returned from popen().
    Fix it to call pclose() as it should.
    
    tools/testing/selftests/kvm/x86_64/mmio_warning_test
    x86_64/mmio_warning_test.c: In function ‘get_warnings_count’:
    x86_64/mmio_warning_test.c:87:9: warning: ‘fclose’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
       87 |         fclose(f);
          |         ^~~~~~~~~
    x86_64/mmio_warning_test.c:84:13: note: returned from ‘popen’
       84 |         f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
index 2cbc09aad7f64..92419b66b0578 100644
--- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
+++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
@@ -84,7 +84,7 @@ int get_warnings_count(void)
 	f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
 	if (fscanf(f, "%d", &warnings) < 1)
 		warnings = 0;
-	fclose(f);
+	pclose(f);
 
 	return warnings;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux