Re: lapi: Add pkt_cls.h fallback

[email protected]
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Andrea,

On Mon, 13 Jul 2026 14:37:07 +0200, Andrea Cervesato wrote:
> lapi: Add pkt_cls.h fallback

--- [PATCH 4/4] ---

> +static int file_fd = -1;
> +static int listen_fd = -1;
> +static int cli_fd = -1;
> +static int acc_fd = -1;

> +	SAFE_CLOSE(cli_fd);
> +	SAFE_CLOSE(acc_fd);

> +	SAFE_CLOSE(file_fd);

> +	if (cli_fd != -1)
> +		SAFE_CLOSE(cli_fd);
> +
> +	if (acc_fd != -1)
> +		SAFE_CLOSE(acc_fd);
> +
> +	if (file_fd != -1)
> +		SAFE_CLOSE(file_fd);

run() closes cli_fd, acc_fd, and file_fd but does not reset them to -1.
cleanup() is always called after run() completes, sees non-(-1) values,
and calls SAFE_CLOSE() a second time. SAFE_CLOSE() calls tst_brk(TBROK)
on EBADF, so the test always ends with TBROK on a clean kernel.

Add reset-to-(-1) after each close in run():

  SAFE_CLOSE(cli_fd);  cli_fd  = -1;
  SAFE_CLOSE(acc_fd);  acc_fd  = -1;
  ...
  SAFE_CLOSE(file_fd); file_fd = -1;

> +#define NETDEV_MAY_REMOVE_QDISC(ifname, family, parent, handle, qd_kind) \
> +	tst_netdev_remove_qdisc(__FILE__, __LINE__, 0, (ifname), (family), \
> +		(parent), (handle), (qd_kind))

The new macro silently tolerates a missing qdisc (strict=0) while the
existing NETDEV_REMOVE_QDISC fails hard. A short comment before the
definition would clarify that distinction for readers.

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.