<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 19, 2022 at 9:40 AM Pengfei Xu <<a href="mailto:pengfei.xu@intel.com">pengfei.xu@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Richard,<br>
<br>
On 2022-10-18 at 16:25:27 +0100, Richard Palethorpe wrote:<br>
> Use memalign instead because we live in the past.<br>
> <br>
> Signed-off-by: Richard Palethorpe <<a href="mailto:rpalethorpe@suse.com" target="_blank">rpalethorpe@suse.com</a>><br>
> Cc: Pengfei Xu <<a href="mailto:pengfei.xu@intel.com" target="_blank">pengfei.xu@intel.com</a>><br>
> ---<br>
> testcases/kernel/syscalls/ptrace/ptrace07.c | 3 ++-<br>
> 1 file changed, 2 insertions(+), 1 deletion(-)<br>
> <br>
> diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c<br>
> index 6bd2b1062..a60c2a49e 100644<br>
> --- a/testcases/kernel/syscalls/ptrace/ptrace07.c<br>
> +++ b/testcases/kernel/syscalls/ptrace/ptrace07.c<br>
> @@ -35,6 +35,7 @@<br>
> #include "config.h"<br>
> #include "ptrace.h"<br>
> #include "tst_test.h"<br>
> +#include "tst_safe_macros.h"<br>
> #include "lapi/cpuid.h"<br>
> <br>
> #ifndef PTRACE_GETREGSET<br>
> @@ -95,7 +96,7 @@ static void do_test(void)<br>
> * of the XSAVE/XRSTOR save area) required by enabled features in XCR0.<br>
> */<br>
> __cpuid_count(CPUID_LEAF_XSTATE, ecx, eax, ebx, ecx, edx);<br>
> - xstate = aligned_alloc(64, ebx);<br>
> + xstate = SAFE_MEMALIGN(64, ebx);<br>
> struct iovec iov = { .iov_base = xstate, .iov_len = ebx };<br>
> int status;<br>
> bool okay;<br>
<br>
Yes, it's better for LTP compilation. Thanks for the patch!<br>
<br>
I checked SAFE_MEMALIGN(), it will verify that the buffer is NULL or not.<br>
"<br>
rval = memalign(alignment, size);<br>
<br>
if (rval == NULL) {<br>
tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,<br>
"memalign() failed");<br>
}<br>
"<br>
So could you remove below unnecessary lines in ptrace07.c, thanks.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">I helped modify this and pushed it, thanks!</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>