All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Deming Wang <wangdeming@inspur.com>,
	akpm@linux-foundation.org, shuah@kernel.org
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: huge_memory: Replace obsolete memalign() with posix_memalign()
Date: Wed, 12 Apr 2023 14:30:59 +0200	[thread overview]
Message-ID: <b5df5cac-5258-7f5c-d386-6b17391b080e@redhat.com> (raw)
In-Reply-To: <20230412104502.1836-1-wangdeming@inspur.com>

On 12.04.23 12:45, Deming Wang wrote:
> memalign() is obsolete according to its manpage.
> 
> Replace memalign() with posix_memalign()
> 
> As a pointer is passed into posix_memalign(), initialize *one_page
> to NULL to silence a warning about the function's return value being

Where is the initialization to NULL done below?

> used as uninitialized (which is not valid anyway because the error
> is properly checked before p is returned).

"p" ?

> 
> Signed-off-by: Deming Wang <wangdeming@inspur.com>
> ---
>   tools/testing/selftests/mm/split_huge_page_test.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
> index cbb5e6893cbf..94c7dffc4d7d 100644
> --- a/tools/testing/selftests/mm/split_huge_page_test.c
> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
> @@ -96,10 +96,10 @@ void split_pmd_thp(void)
>   	char *one_page;
>   	size_t len = 4 * pmd_pagesize;
>   	size_t i;
> +	int ret;
>   
> -	one_page = memalign(pmd_pagesize, len);
> -
> -	if (!one_page) {
> +	ret = posix_memalign((void **)&one_page, pmd_pagesize, len);
> +	if (ret < 0) {
>   		printf("Fail to allocate memory\n");
>   		exit(EXIT_FAILURE);
>   	}

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2023-04-12 12:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 10:45 [PATCH] mm: huge_memory: Replace obsolete memalign() with posix_memalign() Deming Wang
2023-04-12 12:30 ` David Hildenbrand [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-04-13  1:17 Deming Wang
2023-04-13 11:57 ` David Hildenbrand
2023-04-12  7:49 Deming Wang
2023-04-12  8:27 ` David Hildenbrand

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=b5df5cac-5258-7f5c-d386-6b17391b080e@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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: link
Be 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.