lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230413012751.4445-1-wangdeming@inspur.com>
Date:   Wed, 12 Apr 2023 21:27:51 -0400
From:   Deming Wang <wangdeming@...pur.com>
To:     <akpm@...ux-foundation.org>, <shuah@...nel.org>
CC:     <linux-mm@...ck.org>, <linux-kselftest@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, Deming Wang <wangdeming@...pur.com>
Subject: [PATCH] selftests/mm: Replace obsolete memalign() with posix_memalign()

memalign() is obsolete according to its manpage.

Replace memalign() with posix_memalign().

As a pointer is passed into posix_memalign(),initialize *map 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 map is returned).

Signed-off-by: Deming Wang <wangdeming@...pur.com>
---
 tools/testing/selftests/mm/soft-dirty.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c
index 21d8830c5f24..c99350e110ec 100644
--- a/tools/testing/selftests/mm/soft-dirty.c
+++ b/tools/testing/selftests/mm/soft-dirty.c
@@ -80,9 +80,9 @@ static void test_hugepage(int pagemap_fd, int pagesize)
 	int i, ret;
 	size_t hpage_len = read_pmd_pagesize();
 
-	map = memalign(hpage_len, hpage_len);
-	if (!map)
-		ksft_exit_fail_msg("memalign failed\n");
+	ret = posix_memalign((void **)(&map), hpage_len, hpage_len);
+	if (ret < 0)
+		ksft_exit_fail_msg("posix_memalign failed\n");
 
 	ret = madvise(map, hpage_len, MADV_HUGEPAGE);
 	if (ret)
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ