public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Pengfei Xu <pengfei.xu@intel.com>
To: Richard Palethorpe <rpalethorpe@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] ptrace07: Fix compilation by avoiding aligned_alloc
Date: Wed, 19 Oct 2022 09:40:15 +0800	[thread overview]
Message-ID: <Y09Vf7XnoXeEcxJH@xpf.sh.intel.com> (raw)
In-Reply-To: <20221018152527.4636-2-rpalethorpe@suse.com>

Hi Richard,

On 2022-10-18 at 16:25:27 +0100, Richard Palethorpe wrote:
> Use memalign instead because we live in the past.
> 
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> Cc: Pengfei Xu <pengfei.xu@intel.com>
> ---
>  testcases/kernel/syscalls/ptrace/ptrace07.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c
> index 6bd2b1062..a60c2a49e 100644
> --- a/testcases/kernel/syscalls/ptrace/ptrace07.c
> +++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
> @@ -35,6 +35,7 @@
>  #include "config.h"
>  #include "ptrace.h"
>  #include "tst_test.h"
> +#include "tst_safe_macros.h"
>  #include "lapi/cpuid.h"
>  
>  #ifndef PTRACE_GETREGSET
> @@ -95,7 +96,7 @@ static void do_test(void)
>  	 * of the XSAVE/XRSTOR save area) required by enabled features in XCR0.
>  	 */
>  	__cpuid_count(CPUID_LEAF_XSTATE, ecx, eax, ebx, ecx, edx);
> -	xstate = aligned_alloc(64, ebx);
> +	xstate = SAFE_MEMALIGN(64, ebx);
>  	struct iovec iov = { .iov_base = xstate, .iov_len = ebx };
>  	int status;
>  	bool okay;

Yes, it's better for LTP compilation. Thanks for the patch!

I checked SAFE_MEMALIGN(), it will verify that the buffer is NULL or not.
"
	rval = memalign(alignment, size);

	if (rval == NULL) {
		tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
			"memalign() failed");
	}
"
So could you remove below unnecessary lines in ptrace07.c, thanks.
"
-	if (!xstate)
-		tst_brk(TBROK, "aligned_alloc() failed for xstate buffer");
"

Thanks!
BR.

> -- 
> 2.36.1
> 

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

  reply	other threads:[~2022-10-19  1:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 15:25 [LTP] [PATCH 1/2] ptrace07: Fix compilation when not on x86 Richard Palethorpe via ltp
2022-10-18 15:25 ` [LTP] [PATCH 2/2] ptrace07: Fix compilation by avoiding aligned_alloc Richard Palethorpe via ltp
2022-10-19  1:40   ` Pengfei Xu [this message]
2022-10-19  2:59     ` Li Wang
2022-10-19  3:16       ` Pengfei Xu
2022-10-19  3:20         ` Li Wang
2022-10-19  9:30 ` [LTP] [PATCH 1/2] ptrace07: Fix compilation when not on x86 Martin Doucha
2022-10-20  3:53   ` Li Wang
2022-10-20  7:31     ` Richard Palethorpe
2022-10-20 10:41     ` Martin Doucha
2022-10-20 10:59       ` Richard Palethorpe

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=Y09Vf7XnoXeEcxJH@xpf.sh.intel.com \
    --to=pengfei.xu@intel.com \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@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