Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp506161rwl; Tue, 11 Apr 2023 23:18:45 -0700 (PDT) X-Google-Smtp-Source: AKy350bS+lgwTjNWJRmsn1M6OiKTJy39Odd+k7wzvYKDMsJav0P4zgiT0MFcTPVMnt9MxO3atVug X-Received: by 2002:a17:907:3189:b0:94e:54ec:1a10 with SMTP id xe9-20020a170907318900b0094e54ec1a10mr1554330ejb.29.1681280325233; Tue, 11 Apr 2023 23:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681280325; cv=none; d=google.com; s=arc-20160816; b=qFGF4YtGlf3LMJ3vMqIFoNp2ML/5gSnKO9gUQf8Y1mZZotxb77IS90iWFP1s0tGU8C pIYa4rUIW2VOyS/E/bf3Q9rbR4STWSPjWXlKi8RR24J4TkTOxOErfNfK0y2LLWD/qLEC QxNmK5OPAA8bsiCQR1VG8RaU3DxPOysYurfntUMCW4PTM80z/f1YfANKCkK4YYgIR98a 8WQHo+1mihkdsbDhk6aeDpEd/lxyD4gV3CrNa1aK/+J7tNz9HeCuuJC7qfU2wZQKhxMb 1L2Os0eD11AVa3DQ4tkIYLpkC+tg7jwg2cQ21OhA0KAGAMFr5UxXr9PdoLYOgtayTIbc 07dg== 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=+D6zzbGgf80QOUtOcHfNWVE+hUXB/UpYIVKULD/ejqc=; b=MB6G6JLEwmEDEjpdB1jBeN5FTwXr/rFw4ErFMF3y/VrILpLKAJ4++y00Ysi5s7QmVG uiJNXAUybN4M5v7aQVkBc1fJpXoeHg3c6CSYLe5zBJ133RfkN6fBjlX7Vrm0+JhWvZjI ayTTCH9WjqyfrVcWMxeuAoO1ohzeSBQzV+IifBnMUaI2h7DJ8tHFU05r8R11XcPMizQD FHA4sFCOG/y5ZqUc3NUsGPHLZs4thpflYv1EfpMaOhkhK9Q9/wtA8Dd+IMyQ+mjV663Z vUfJH8x5mvhttWM4BhSYn5b/hNBwJ1YKSJnBmj42RLnCp2B3oCGwLeRx3LxFVNhpmeVh sy8w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec19-20020a170906b6d300b00925a9b6ed47si347136ejb.755.2023.04.11.23.18.20; Tue, 11 Apr 2023 23:18:45 -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 S229477AbjDLGRG (ORCPT + 99 others); Wed, 12 Apr 2023 02:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjDLGRF (ORCPT ); Wed, 12 Apr 2023 02:17:05 -0400 Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7864040D8 for ; Tue, 11 Apr 2023 23:17:03 -0700 (PDT) Received: from unicom146.biz-email.net by unicom146.biz-email.net ((D)) with ASMTP (SSL) id HAC00055; Wed, 12 Apr 2023 14:16:55 +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 14:16:55 +0800 From: Deming Wang To: , , CC: , Deming Wang Subject: [PATCH] virt: acrn: Replace obsolete memalign() with posix_memalign() Date: Wed, 12 Apr 2023 02:16:53 -0400 Message-ID: <20230412061653.1676-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.200.104.82] tUid: 2023412141655bdafd77d197334c1737fadabc963d849 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 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; } -- 2.27.0