public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v6 1/3] syscalls/modify_ldt: Add lapi/ldt.h
Date: Mon, 7 Apr 2025 14:09:27 +0200	[thread overview]
Message-ID: <Z_PAd1a_oIVnREsQ@yuki.lan> (raw)
In-Reply-To: <20250402-conversions-modify_ldt-v6-1-2e4b0e27870e@suse.com>

Hi!
> +static inline int modify_ldt(int func, const struct user_desc *ptr,
> +			     unsigned long bytecount)
> +{
> +	return tst_syscall(__NR_modify_ldt, func, ptr, bytecount);
> +}
> +
> +static inline int safe_modify_ldt(const char *file, const int lineno, int func,
> +				  const struct user_desc *ptr,
> +				  unsigned long bytecount)
> +{
> +	int rval;
> +
> +	rval = modify_ldt(func, ptr, bytecount);
> +	if (rval == -1)
> +		tst_brk_(file, lineno, TBROK | TERRNO,
> +			 "modify_ldt(%d, %p, %lu)", func, ptr, bytecount);

We should make sure that we only accept the success value here (as we do
in the rest of the safe macros) so that we catch the cases when kernel
returns an invalid value.

This should be:

	if (rval == -1) {
		tst_brk_(...);
	} else if (rval) {
		tst_brk_("modify_ltd(...) invalid retval %i", ...);
	}


With that fixed:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-04-07 12:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  9:58 [LTP] [PATCH v6 0/3] syscalls/modify_ldt: Refactor into new API Ricardo B. Marlière via ltp
2025-04-02  9:58 ` [LTP] [PATCH v6 1/3] syscalls/modify_ldt: Add lapi/ldt.h Ricardo B. Marlière via ltp
2025-04-07 12:09   ` Cyril Hrubis [this message]
2025-04-07 12:18     ` Ricardo B. Marli��re via ltp
2025-04-02  9:58 ` [LTP] [PATCH v6 2/3] syscalls/modify_ldt02: Refactor into new API Ricardo B. Marlière via ltp
2025-04-07 12:24   ` Cyril Hrubis
2025-04-02  9:58 ` [LTP] [PATCH v6 3/3] syscalls/modify_ldt01: " Ricardo B. Marlière via ltp
2025-04-07 12:41   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_PAd1a_oIVnREsQ@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rbm@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox