Re: landlock: fix make check warnings/errors

[email protected]
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.