From patchwork Wed Apr 12 09:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 13208722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F1B5C77B6E for ; Wed, 12 Apr 2023 10:06:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E21F7900003; Wed, 12 Apr 2023 06:06:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA8A0900002; Wed, 12 Apr 2023 06:06:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7067900003; Wed, 12 Apr 2023 06:06:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B834D900002 for ; Wed, 12 Apr 2023 06:06:46 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 10872C2E31 for ; Wed, 12 Apr 2023 09:35:33 +0000 (UTC) X-FDA: 80672231346.01.6D91565 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by imf30.hostedemail.com (Postfix) with ESMTP id BE66080003 for ; Wed, 12 Apr 2023 09:35:29 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf30.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681292131; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=CKXAA4efZHnnNuCEyxLoBmCV3TOiFptIl67VQa7hbyw=; b=1isrU4j40rE7VPSTqPpUqVBCvbMbVKLcVwDdUOxBmA7lwLkLlW94guYwB7e58HzcMr6yir aH27aXA5wkeM03YXp6gS+W7yoF5cZZ0ihTgsAHFSWZK5Omno6T1dN3bHwvj7yWZAIdguVb NKtJcFgfWZvYvj+OXSAYHzh0KXK7UdQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf30.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681292131; a=rsa-sha256; cv=none; b=rA4SZLI9J5CbCL1GspJ9I6DBGUrm7mjx+1hi68y4O7rM2yz80wvauNLB8xxOITTwbcmDtq 0twa/m0ppYEHfgB3DPHDLS6RQ7/ZVejhhFgKN52G5Wu3Lw2ux3+VIHC+wMZlKutZZrovI4 VA6R3Mfc/Ebi2lDvc5YWaQ9cymrAbzc= Received: from unicom145.biz-email.net by unicom145.biz-email.net ((D)) with ASMTP (SSL) id IFW00122; Wed, 12 Apr 2023 17:35:22 +0800 Received: from localhost.localdomain.com (10.200.104.82) by jtjnmail201603.home.langchao.com (10.100.2.3) with Microsoft SMTP Server id 15.1.2507.21; Wed, 12 Apr 2023 17:35:22 +0800 From: Deming Wang To: , CC: , , , Deming Wang Subject: [PATCH] selftests/mm: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 05:35:20 -0400 Message-ID: <20230412093520.1591-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 2023412173522d022ab94ac53f1569611c052fd20a5b4 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BE66080003 X-Stat-Signature: uimdrr3rpsq3ffczyipobb9e4t5nerhd X-Rspam-User: X-HE-Tag: 1681292129-565932 X-HE-Meta: U2FsdGVkX1+oQgeIuzLqEiS+dA0VbI95N+/KSq2/zYYmj3JwUHoA58z637qAFS4yX6LDUSX3gCu+A8qbHM1LFhuVRKrG6Ry3kvF3vcP5znz7cibSegdLMzJtzwDZ+S42K8Kuru0ITAZ4IGDySQllkZZPR7VCs5FPFlkb+e0Q92zVR8knkjOZAu8b6nAI4T7lmCWOGpIErSolbqqZbYIEIPQebuaRj3hSt/nYvi6N8S2Wk90ERL7FQ8z5yKuZb4iW0GSf5n4siRX6dSjIaNB2ueueqdLhvtvRHi91uWUsQisbaQgR+GDrx1nitZVK9qb/axf55v3058XIdGh1kZPW3kk/YO0PlM4bNEAEWo9YwYe+5aR3NHu1GWjC+SczcfWfJiryiZaWUzS78bznDHhD5ZPOtSzZKGNASfoLlcsugwJ8s+/n8zZgkY2ShA3O620/1+4Az7a/we/bNqIfFF77LAy4LkjhzV9aY8D0PCQaETA7yCK0UKYy+B4jCehBdzx3mnkEsvXzz8ekGfzsxOZ/okRvOb7a/+fKxbc0FekQkaFECRZPptjhkZn10EN/QavDczhqGiRnbUWzsor4imvCC5DSjEu9fipnty1SoD0IHQrkFNpQV3v/IK2fADGO4OKhMExrc4VLwzzCqM6hmIegttNP1wHdQbH+hsc6gfr8pLjfgn5LCVD5OcOXsic5LKzW5xZlN0dpH8uVBjFt0ALcm5RKthB8O3UgDF/8MLPE8RU0SwVmfiMftGDMqiLASfqW+JAk//L277xyGjofHOWfG3X/yWwLC8KE6SeSL2ms+PhW2dwSuK4VXYCDK0pAO8FgSOht6N4DYELXxIJAQK9Yfho08Pm2ycIv0UkSntlH6vhAk+h4ogZ4TCSuopzxP5lOXUzZSXiflR+F4P5ZyLt3iHtBBWyjwvS9+xlf7oQ4TksQnkFX99cv0SaPCZBm144IQh+XuK9p2HIFHM0/7AC nVKMEVOv Zb6cepeakdN53e+D8guOsiVxAziMyK1lyODvDKf29BQMKsWCVvPeJb9NmIfUcUi8T+a2Ab/fg35rFB71DprPQXwOdvYgh3mRkKisxThhmAAdC4rIndCc9iameNbtjRNzXB5FAEBr2c1z+dSy2obXHVt+b/PrOM106KMRX/GsKaDiDnJiQgVwyzstv0HJ3tEm04MuwhVW7Yv2bIWbd+V780U1vrA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 p is returned). Signed-off-by: Deming Wang --- 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)