[LTP] fallocate01: Convert to new API

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon Jul 20 15:16:33 CEST 2026


Hi Andrea,

On Mon, 20 Jul 2026 13:48:26 +0200, Andrea Cervesato wrote:
> fallocate01: Convert to new API

--- [PATCH 1/2] ---

> +static void setup(void)
> +{
> +	char fname[NAME_MAX];
> +	struct stat file_stat;
> +
> +	snprintf(fname, sizeof(fname), "tfile_%d", getpid());

The filename buffer is one byte short. Per the LTP coding standard
(c-tests.md, "Path Buffers" section), a buffer holding only a filename
component must be NAME_MAX + 1 bytes to accommodate the null terminator
when the filename is exactly NAME_MAX characters long.

In this specific case the generated name is at most ~29 bytes and there
is no actual overflow, but the declaration should still read:

	char fname[NAME_MAX + 1];

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