Re: [PATCH] selftests: tpm2: Implement class desstructor to close file descriptor

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

 



s/desstructor/destructor/

I'd change it to "selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle"

On Fri, Sep 09, 2022 at 11:20:56AM -0400, Stefan Berger wrote:
> From: Stefan Berger <stefanb@xxxxxxxxxxxxx>
> 
> Implement a class destructor to close the open TPM file descriptor
> and avoid the following error message:
> 
>  test_flush_context (tpm2_tests.SpaceTest) ... \
>    /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
>    unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True>

I don't recall seeing this. Does this happen on every test case?

Should better describe what is going on, e.g.

"
The following output can bee seen when the test is executed:

  test_flush_context (tpm2_tests.SpaceTest) ... \
    /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
    unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True>

An instance of Client does not implicitly close /dev/tpm* handle, once it
gets destroyed. Close the file handle in the class destructor
Client.__del__().
"

> 
> Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests")
> Cc: Shuah Khan <shuah@xxxxxxxxxx>
> Cc: linux-kselftest@xxxxxxxxxxxxxxx
> Cc: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>

BR, Jarkko



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux