public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/3] lib: Introduce TESTPTR()
Date: Wed, 20 Jun 2018 12:08:11 +0200	[thread overview]
Message-ID: <20180620100811.GC21435@rei> (raw)
In-Reply-To: <20180620075917.21056-2-pvorel@suse.cz>

Hi!
> +extern void *TEST_RETURN_PTR;
> +
> +#define TESTPTR(SCALL) \
> +	do { \
> +		errno = 0; \
> +		TEST_RETURN_PTR = (void*)(TEST_RETURN = (intptr_t)SCALL); \

I guess that this expression is safe enough, since TEST_RETURN is long,
so the assigment will not overflow, but that also begs a question why do
we assign it in the first place?

> +		TEST_ERRNO = errno; \
> +	} while (0)
> +
>  /*
>   * Functions to convert ERRNO to its name and SIGNAL to its name.
>   */
> diff --git a/lib/tst_res.c b/lib/tst_res.c
> index 8ff7ee425..84becbef4 100644
> --- a/lib/tst_res.c
> +++ b/lib/tst_res.c
> @@ -55,6 +55,7 @@
>  
>  long TEST_RETURN;
>  int TEST_ERRNO;
> +void *TEST_RETURN_PTR;

Can we please name it a bit better so that we avoid renaming it later
on? What about TST_RET_PTR so that it's consistent with the planned
rename of TEST_RETURN to just TST_RET?

>  #define VERBOSE      1
>  #define NOPASS       3
> -- 
> 2.17.1
> 

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2018-06-20 10:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20  7:59 [LTP] [PATCH 1/3] lib: Add SAFE_CHROOT(path) macro Petr Vorel
2018-06-20  7:59 ` [LTP] [PATCH 2/3] lib: Introduce TESTPTR() Petr Vorel
2018-06-20 10:08   ` Cyril Hrubis [this message]
2018-06-20  7:59 ` [LTP] [PATCH 3/3] cve/cve-2018-1000001: Add Realpath Buffer Underflow test Petr Vorel
2018-06-20 10:04 ` [LTP] [PATCH 1/3] lib: Add SAFE_CHROOT(path) macro Cyril Hrubis
2018-06-20 12:26   ` Petr Vorel

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=20180620100811.GC21435@rei \
    --to=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