All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Teo Couprie Diaz <teo.coupriediaz@arm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [RFC PATCH 1/1] regen.sh: Use intptr_t for tst_syscall return
Date: Mon, 31 Oct 2022 14:32:55 +0100	[thread overview]
Message-ID: <Y1/Oh4VCUiUSFIvK@yuki> (raw)
In-Reply-To: <20221027163654.414017-2-teo.coupriediaz@arm.com>

Hi!
> Some syscalls directly return pointers, like brk or mmap. int is currently
> used for the return value in tst_syscall but is not large enough
> to guarantee that such a returned value will fit.
> Instead, use intptr_t which is guaranted to be castable to (void *)
> without loss of data.

Sounds reasonable, glibc syscall returns long but I guess that's because
there was no intptr_t when that was introduced.

> Signed-off-by: Teo Couprie Diaz <teo.coupriediaz@arm.com>
> ---
>  include/lapi/syscalls/regen.sh |   2 +-
>  runtest/check_tst_syscall      | 190 +++++++++++++++++++++++++++++++++
>  2 files changed, 191 insertions(+), 1 deletion(-)
>  create mode 100644 runtest/check_tst_syscall
> 
> diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
> index 3bf38fd03..97027e2f3 100755
> --- a/include/lapi/syscalls/regen.sh
> +++ b/include/lapi/syscalls/regen.sh
> @@ -48,7 +48,7 @@ cat << EOF > "${output_pid}"
>  #endif
>  
>  #define tst_syscall(NR, ...) ({ \\
> -	int tst_ret; \\
> +	intptr_t tst_ret; \\
>  	if (NR == __LTP__NR_INVALID_SYSCALL) { \\
>  		errno = ENOSYS; \\
>  		tst_ret = -1; \\
> diff --git a/runtest/check_tst_syscall b/runtest/check_tst_syscall
> new file mode 100644
> index 000000000..7a6003593
> --- /dev/null
> +++ b/runtest/check_tst_syscall

I do not think that we shoud add this file, at least not in this commit
and without any good description.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2022-10-31 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 16:36 [LTP] [RFC PATCH 0/1] Change return type of tst_syscall Teo Couprie Diaz
2022-10-27 16:36 ` [LTP] [RFC PATCH 1/1] regen.sh: Use intptr_t for tst_syscall return Teo Couprie Diaz
2022-10-31 13:32   ` Cyril Hrubis [this message]
2022-10-31 17:18     ` Teo Couprie Diaz
2022-10-31 17:41       ` Cyril Hrubis
2022-11-01 10:09         ` Teo Couprie Diaz

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=Y1/Oh4VCUiUSFIvK@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=teo.coupriediaz@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.