From: Michael Ellerman <mpe@ellerman.id.au> To: Deming Wang <wangdeming@inspur.com>, shuah@kernel.org Cc: Deming Wang <wangdeming@inspur.com>, linux-kernel@vger.kernel.org, npiggin@gmail.com, linux-kselftest@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 22:02:50 +1000 [thread overview] Message-ID: <87o7nti9zp.fsf@mpe.ellerman.id.au> (raw) In-Reply-To: <20230412111237.2007-1-wangdeming@inspur.com> Deming Wang <wangdeming@inspur.com> writes: > memalign() is obsolete according to its manpage. > > Replace memalign() with posix_memalign() and remove malloc.h include > that was there for memalign(). > > As a pointer is passed into posix_memalign(), initialize *s to NULL > to silence a warning about the function's return value being used as > uninitialized (which is not valid anyway because the error is properly > checked before p is returned). The patch doesn't do that. There is no p? I think you've copied the change log for a whole bunch of commits but not updated them to be accurate for each change? cheers > diff --git a/tools/testing/selftests/powerpc/stringloops/strlen.c b/tools/testing/selftests/powerpc/stringloops/strlen.c > index 9055ebc484d0..f9c1f9cc2d32 100644 > --- a/tools/testing/selftests/powerpc/stringloops/strlen.c > +++ b/tools/testing/selftests/powerpc/stringloops/strlen.c > @@ -1,5 +1,4 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include <malloc.h> > #include <stdlib.h> > #include <string.h> > #include <time.h> > @@ -51,10 +50,11 @@ static void bench_test(char *s) > static int testcase(void) > { > char *s; > + int ret; > unsigned long i; > > - s = memalign(128, SIZE); > - if (!s) { > + ret = posix_memalign((void **)&s, 128, SIZE); > + if (ret < 0) { > perror("memalign"); > exit(1); > } > -- > 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au> To: Deming Wang <wangdeming@inspur.com>, shuah@kernel.org Cc: npiggin@gmail.com, christophe.leroy@csgroup.eu, linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Deming Wang <wangdeming@inspur.com> Subject: Re: [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 22:02:50 +1000 [thread overview] Message-ID: <87o7nti9zp.fsf@mpe.ellerman.id.au> (raw) In-Reply-To: <20230412111237.2007-1-wangdeming@inspur.com> Deming Wang <wangdeming@inspur.com> writes: > memalign() is obsolete according to its manpage. > > Replace memalign() with posix_memalign() and remove malloc.h include > that was there for memalign(). > > As a pointer is passed into posix_memalign(), initialize *s to NULL > to silence a warning about the function's return value being used as > uninitialized (which is not valid anyway because the error is properly > checked before p is returned). The patch doesn't do that. There is no p? I think you've copied the change log for a whole bunch of commits but not updated them to be accurate for each change? cheers > diff --git a/tools/testing/selftests/powerpc/stringloops/strlen.c b/tools/testing/selftests/powerpc/stringloops/strlen.c > index 9055ebc484d0..f9c1f9cc2d32 100644 > --- a/tools/testing/selftests/powerpc/stringloops/strlen.c > +++ b/tools/testing/selftests/powerpc/stringloops/strlen.c > @@ -1,5 +1,4 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include <malloc.h> > #include <stdlib.h> > #include <string.h> > #include <time.h> > @@ -51,10 +50,11 @@ static void bench_test(char *s) > static int testcase(void) > { > char *s; > + int ret; > unsigned long i; > > - s = memalign(128, SIZE); > - if (!s) { > + ret = posix_memalign((void **)&s, 128, SIZE); > + if (ret < 0) { > perror("memalign"); > exit(1); > } > -- > 2.27.0
next prev parent reply other threads:[~2023-04-12 12:03 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-12 11:12 [PATCH] selftests/powerpc: Replace obsolete memalign() with posix_memalign() Deming Wang 2023-04-12 11:12 ` Deming Wang 2023-04-12 12:02 ` Michael Ellerman [this message] 2023-04-12 12:02 ` Michael Ellerman 2023-04-13 1:02 Deming Wang 2023-04-13 1:02 ` Deming Wang 2023-04-28 8:09 ` Muhammad Usama Anjum 2023-04-28 8:09 ` Muhammad Usama Anjum
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=87o7nti9zp.fsf@mpe.ellerman.id.au \ --to=mpe@ellerman.id.au \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=npiggin@gmail.com \ --cc=shuah@kernel.org \ --cc=wangdeming@inspur.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: linkBe 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.