[LTP] landlock: fix make check warnings/errors

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon Jul 6 16:38:06 CEST 2026


Hi Andrea,

On Mon, 06 Jul 2026, Andrea Cervesato wrote:
> landlock: fix make check warnings/errors

> -			if (strstr(readdir_files[i], de->d_name) != NULL)
> +			if (!strstr(readdir_files[i], de->d_name))
>  				files_counted++;

This inverts the condition. The original incremented files_counted when
de->d_name was found in readdir_files[i]. The patched version increments
it when de->d_name is NOT found.

Removing the redundant != NULL comparison should produce:

    if (strstr(readdir_files[i], de->d_name))
        files_counted++;

With the ! prefix the count tracks non-matches instead of matches, so
TST_EXP_EQ_LI(files_counted, ARRAY_SIZE(readdir_files)) at the end of
_test_readdir() will produce wrong results.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list