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

2024-06-26 Thread Shuah Khan
On 6/26/24 13:33, Shuah Khan wrote: On 6/26/24 01:20, 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 cl

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

2024-06-26 Thread Shuah Khan
On 6/26/24 01:20, 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] 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 find such information helpful? > If the > initialization of variable 'to' fails, The

[PATCH] 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. Fixes: 32ae976ed3b5 ("selftes