Re: [PATCH v2] selftests/capabilities: Fix possible file leak in copy_fromat_to

2024-06-27 Thread Shuah Khan
On 6/26/24 19:57, Ma Ke wrote: The open() function returns -1 on error. openat() and open() initialize 'from' and 'to', and only 'from' validated with 'if' statement. If the initialization of variable 'to' fails, we should better check the value of 'to' and close 'from' to avoid possible file lea

Re: [PATCH v2] selftests/capabilities: Fix possible file leak in copy_fromat_to

2024-06-26 Thread Markus Elfring
>… openat() and open() initialize > 'from' and 'to', and only 'from' validated with 'if' statement. Why do you find such information helpful? > If the > initialization of variable 'to' fails,

[PATCH v2] selftests/capabilities: Fix possible file leak in copy_fromat_to

2024-06-26 Thread Ma Ke
The open() function returns -1 on error. openat() and open() initialize 'from' and 'to', and only 'from' validated with 'if' statement. If the initialization of variable 'to' fails, we should better check the value of 'to' and close 'from' to avoid possible file leak. Improve the checking of 'from'