From patchwork Wed Apr 12 07:30:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 82292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp144258vqo; Wed, 12 Apr 2023 00:57:05 -0700 (PDT) X-Google-Smtp-Source: AKy350ZxNeucrt/QSY4MNhXVfND7TuvvkejFa6clz4UDoc+xZILgy4FsJUEXhyzSeDu8LgJtvQGF X-Received: by 2002:a17:906:a20b:b0:94e:3d6f:9c0f with SMTP id r11-20020a170906a20b00b0094e3d6f9c0fmr1431107ejy.55.1681286225469; Wed, 12 Apr 2023 00:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681286225; cv=none; d=google.com; s=arc-20160816; b=unS24spavFuyGuctCr58B0Rr3OOQr0xhf814UCKUq/CATaN43vTSjG5pTT4g3RMdaF xvjtSTOyaoTc1NkTRijxpHJMga38ePDHQscsqUHo96P/quB4gBQpECzVNuGuE1NHPPa2 QZXBOdTrNwvEuTE1qfQpjBabDf10IFLPnTW05y0NMuArs9mKqxppvhWi6/zXGWD9dkGw XOzAXoyBXUG6ZF5CQ+4qZ8uaYFxq2LEbVw6mIYOKRtAtDJWlAHDPm5m/ixU9bfWY2CvI jc4BiE939q4CMqNbm702oYGeeGaVlmEYtItsH8vdr5lD2XYpCEhTuaP64t724oMvWVgU E+RQ== 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=dO/RwEf4M2qi6AX+LVzhpsUK7RMloZMOFb8Nic8iZXs=; b=xecme47f//k3U/xJWCJ3lftSpScJXzKm6tG51EOtiZyBTkdcDpIlSzvQ8e1unPEl4p buFdp02oHqY60o0vqCSzks3EP0Hm2EH7jZ6IxKM+lF1slPL8wVAsrZZ9/9aLia/GyTNo 3xz/UurYvUqeBJcf9weS+RUs9hT+UFU4BEuOYWUPs8Hofld6He2DmeJySoJ7WLR8gmKi AmmKNxj9pV5ygqmCtkO9D7PnRqJBZNffwgxX00AjX2xhCzXN2Y93QPzQ328DoEtf31HK nwRP9xUI6egmX6D0JVKN73t7rP4PohM6/W388M6A7aij+EfEG6T12b4tCAGOgUBwaDnW fjOQ== 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 t2-20020a1709064f0200b0094a69ce7af0si6999700eju.1045.2023.04.12.00.56.41; Wed, 12 Apr 2023 00:57:05 -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 S229747AbjDLHay (ORCPT + 99 others); Wed, 12 Apr 2023 03:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjDLHaw (ORCPT ); Wed, 12 Apr 2023 03:30:52 -0400 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 088AEF9 for ; Wed, 12 Apr 2023 00:30:50 -0700 (PDT) Received: from unicom145.biz-email.net by unicom145.biz-email.net ((D)) with ASMTP (SSL) id HBQ00048; Wed, 12 Apr 2023 15:30:48 +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 15:30:47 +0800 From: Deming Wang To: , , CC: , Deming Wang Subject: [PATCH] virt: acrn: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 03:30:41 -0400 Message-ID: <20230412073041.2168-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.200.104.82] tUid: 20234121530489829633825b50c05662226213d82dda3 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?1762950241574708071?= X-GMAIL-MSGID: =?utf-8?q?1762956385472643913?= 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 *p 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 --- samples/acrn/vm-sample.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/acrn/vm-sample.c b/samples/acrn/vm-sample.c index 7abd68b20153..2656189093ef 100644 --- a/samples/acrn/vm-sample.c +++ b/samples/acrn/vm-sample.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -54,8 +53,8 @@ int main(int argc, char **argv) argc = argc; argv = argv; - guest_memory = memalign(4096, GUEST_MEMORY_SIZE); - if (!guest_memory) { + ret = posix_memalign(&guest_memory, 4096, GUEST_MEMORY_SIZE); + if (ret < 0) { printf("No enough memory!\n"); return -1; }