From patchwork Wed Apr 12 10:45:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 82379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp230406vqo; Wed, 12 Apr 2023 03:58:25 -0700 (PDT) X-Google-Smtp-Source: AKy350Zh1gKAxmaOfmm+WOaqzJgVW3UZjItSND5DEActjFFGpQKDYhq6TMiWJp5ptu4SDrWPRyu1 X-Received: by 2002:a17:906:2bd7:b0:932:cec7:6801 with SMTP id n23-20020a1709062bd700b00932cec76801mr14371096ejg.54.1681297105088; Wed, 12 Apr 2023 03:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681297105; cv=none; d=google.com; s=arc-20160816; b=ybd5P8d4HK1Gr5TyZ0FI5d3PyeqX19ebROXViBo+51UAq9wF03EDebraKhijmXAheU 2gx0JMadvoH3QehhQiRgkLsVSTe6nqGWnHHLw+kWQBrCzciSlG/azdayYTUwPmWm5Qm/ xqpMK0VAahq258jtyixjMUa1HckTZqi6YTlOhCptyDuoSSEeABcQoB/kIVv2Vx1PUu9W L4X2CCJjQkRP4/KcOjVvGmDbw8aJxDUzkcY9Zavikq9Palw9uPTJYQM3Gxr+KuOK68rV x/siq/SZf36imDK7H0rHQ6o99IDT4rWtaWISAIZzzEted3zSo+teLTQyqpN+ou+E+70o FU9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=8jZUqfh11BvzJ4DhNExMxC8at8LrHEtNZKUZh8SwCQY=; b=Renz+yAWdSfW1nZmAXeABknimpYCNLzcoxoHXHm35DgYYKOduhIm9YtXYHAraAzWxe ZFVu72i0fZFIjdCu/QC3ZFVmOHKf1B9p/kFUPI2lyfOgzdNhPkolAxR/TwfFu9YmUcU+ cksL6uv8sFC5vtX0TzYY+a14fn0uO2+YTHhZMn3AXdaDK1ilHeZyQngFzWR28L7OLS4y MYQZpDRQ1/mDShR1x4wWtiwZvcRe0eec7fdDV33UMr/iRE67wdOSQ0y6mXGPmkWfNdcW kbWGRlsgY91giTn0ntzmrJCxp7USCDv3JsNyu3FV5Sr5Yb12A+54ad4jvhcgPHWNhwz5 XqdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id de18-20020a1709069bd200b0094dad5252b4si4423171ejc.169.2023.04.12.03.58.01; Wed, 12 Apr 2023 03:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbjDLKpN (ORCPT + 99 others); Wed, 12 Apr 2023 06:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbjDLKpM (ORCPT ); Wed, 12 Apr 2023 06:45:12 -0400 Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A21D15BB6; Wed, 12 Apr 2023 03:45:09 -0700 (PDT) Received: from unicom146.biz-email.net by unicom146.biz-email.net ((D)) with ASMTP (SSL) id IGG00003; Wed, 12 Apr 2023 18:45:03 +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 18:45:05 +0800 From: Deming Wang To: , CC: , , , Deming Wang Subject: [PATCH] mm: huge_memory: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 06:45:02 -0400 Message-ID: <20230412104502.1836-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 2023412184503ad0aa4e8d89a0fbe2ece5da72dc0b0a0 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-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762967793235875748?= X-GMAIL-MSGID: =?utf-8?q?1762967793235875748?= 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 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/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); }