ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Teo Couprie Diaz <teo.coupriediaz@arm.com>
To: Cyril Hrubis <chrubis@suse.cz>
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 17:18:09 +0000	[thread overview]
Message-ID: <99c55c0c-1f51-5282-6198-dbcb6d919ea3@arm.com> (raw)
In-Reply-To: <Y1/Oh4VCUiUSFIvK@yuki>

Hello,

On 31/10/2022 13:32, Cyril Hrubis wrote:
> 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.

I agree, I wouldn't want to merge it.
As mentioned in the cover, I wanted to share the list of tests I have 
tested the patch with,
both for people to test themselves if they want to and as a way to ask 
if there was anything I missed
while testing with that.
I didn't really know how to share this, so I added it as part of the 
commit for the RFC. Maybe it would
fit better as part of the cover letter ? Or after the commit description 
with the shortlog ?
It might be better removed altogether and people can test with a larger 
scope anyway !

Thanks for having a look,
Best regards
Téo Couprie Diaz


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

  reply	other threads:[~2022-10-31 17:19 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
2022-10-31 17:18     ` Teo Couprie Diaz [this message]
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=99c55c0c-1f51-5282-6198-dbcb6d919ea3@arm.com \
    --to=teo.coupriediaz@arm.com \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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;
as well as URLs for NNTP newsgroup(s).