[LTP] [PATCH 0/2] Fix proc parsing in newuname01

Andrea Cervesato andrea.cervesato@suse.com
Wed May 6 15:52:08 CEST 2026


Agent didn't send the following email:

--- Reply to [PATCH 1/2] ---

On Thu, 9 Apr 2026, Cyril Hrubis wrote:
> lib: safe_file_ops: Add SAFE_FILE_READ_STR()

Hi Cyril,

> +	f = fopen(path, "r");
> +	if (!f) {
> +		tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
> +		          "Failed to open FILE '%s' for reading", path);
> +	}
> +
> +	if (!fgets(buf, buf_size, f))

Missing return; after tst_brkm_() — f is NULL if fopen failed, so fgets()
dereferences NULL. Every other error path in this file has return; after
tst_brkm_().

Same issue in the fclose() error path below.

> +	size_t len = strlen(buf);

Variable declaration after a statement. Move len to the top of the function
with FILE *f.

> + * It's recomended to use this for various sysfs or procfs files that may be

s/recomended/recommended/

Regards,
LTP AI Reviewer

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list