public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: "Ricardo B. Marli��re via ltp" <ltp@lists.linux.it>
To: "Cyril Hrubis" <chrubis@suse.cz>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v6 1/3] syscalls/modify_ldt: Add lapi/ldt.h
Date: Mon, 07 Apr 2025 09:18:16 -0300	[thread overview]
Message-ID: <D90EFMZN80VM.342MIYQMFIK8N@suse.com> (raw)
In-Reply-To: <Z_PAd1a_oIVnREsQ@yuki.lan>

On Mon Apr 7, 2025 at 9:09 AM -03, Cyril Hrubis wrote:
> 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", ...);
> 	}

Makes sense! Unfortunately I just sent a v7, will wait some more before
sending the next one :)

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

Thanks for reviewing,
-	Ricardo.



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

  reply	other threads:[~2025-04-07 12:18 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
2025-04-07 12:18     ` Ricardo B. Marli��re via ltp [this message]
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=D90EFMZN80VM.342MIYQMFIK8N@suse.com \
    --to=ltp@lists.linux.it \
    --cc=chrubis@suse.cz \
    --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