Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4356187imu; Mon, 7 Jan 2019 21:47:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN5CRxEQQBUlZl6VFFRJsF+g1dcct4xMOoU3bD0ODUqw4VnG0oMtJejR0sxZLHaUJM37+PC7 X-Received: by 2002:a63:ec13:: with SMTP id j19mr387629pgh.6.1546926434312; Mon, 07 Jan 2019 21:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546926434; cv=none; d=google.com; s=arc-20160816; b=Exg71a6ko89zqnh7GQTkX3EImlthQf/9l5LpUaVm9c/12rZ/lN1/IyOL0SSMw6tOvH 5uhko1a4PlkhRBDhOCQ72+WXWCMl3jXuk3MBOWr5I3VhW97BBp1C+qJ+bv5PSoEW91Ze eP2NuCQrJnHyvt6gEBC62hhQUNYZLf64HFVPjNZE5G0FWV/wJzTw9/yrUjPr3Q7GEyoj +cgzSzUtO6Hyw/3OXeo8xIU5eHuwnEVlyfXWiNjPWZwh5aHLkpM7XuJvBO3e5uTC3FjJ I2b5qusZYUIGouYXVKCJixh2R/AhEz5EW1fmJ08cE8KPVUvmc12obnxtKn5ADcER6ltw XhXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=6YETCosF7tS73WTB9P6vk37GxbS4cYkk0hozoSo5ImA=; b=lg/Qey98COnXCrmRh9RvHAKU3Bn9RMALlV3Zf5kTQMFpHKW5UtEatlMUMQCqDQPKnm z6e6DYh97MUPsys4n1EX0ZHJGwj6O+PtSRserxGzTQQwID/oZ/wrfuG4+le+1F3cK4Rh IKb2j5q6xPYPjhwBTuzI2FiUzXuWr+L7GVgp+x0XZegjIiz8vB51Xh/rxLsaQ0ueU1zo TT0z13NHyxGD+w213Kb7710U+T0E4P2sphw4Js5U3zJj86ScemCm7cvsUvodW3QVPZJF Jk4Df5dl0nHhMR05bEn9SaJ9J8vPcrX4BHSeZJHusWKr6lIbiS/yhQXEJr5tY+59yJWf aUCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o184si6028600pgo.591.2019.01.07.21.46.58; Mon, 07 Jan 2019 21:47:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727786AbfAHFmk (ORCPT + 99 others); Tue, 8 Jan 2019 00:42:40 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:48368 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727393AbfAHFmj (ORCPT ); Tue, 8 Jan 2019 00:42:39 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id D9A05A10950803A48DCA; Tue, 8 Jan 2019 13:42:36 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x085gUe0006096; Tue, 8 Jan 2019 13:42:30 +0800 (GMT-8) (envelope-from wang.yi59@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019010813424340-21023466 ; Tue, 8 Jan 2019 13:42:43 +0800 From: Yi Wang To: tglx@linutronix.de Cc: mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, akpm@linux-foundation.org, rppt@linux.vnet.ibm.com, mhocko@suse.com, pavel.tatashin@microsoft.com, joe@perches.com, jschoenh@amazon.de, m.mizuma@jp.fujitsu.com, n-horiguchi@ah.jp.nec.com, linux-kernel@vger.kernel.org, xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn, "huang.zijiang" Subject: [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function Date: Tue, 8 Jan 2019 13:42:17 +0800 Message-Id: <1546926137-32136-1-git-send-email-wang.yi59@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-01-08 13:42:43, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-08 13:42:26, Serialize complete at 2019-01-08 13:42:26 X-MAIL: mse01.zte.com.cn x085gUe0006096 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "huang.zijiang" kmemdup has implemented the function that kmalloc() and memcpy(). Signed-off-by: huang.zijiang --- arch/x86/kernel/e820.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 50895c2..a687d10 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -671,21 +671,18 @@ __init void e820__reallocate_tables(void) int size; size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table->nr_entries; - n = kmalloc(size, GFP_KERNEL); + n = kmemdup(e820_table, size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820_table, size); e820_table = n; size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table_kexec->nr_entries; - n = kmalloc(size, GFP_KERNEL); + n = kmemdup(e820_table_kexec, size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820_table_kexec, size); e820_table_kexec = n; size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table_firmware->nr_entries; - n = kmalloc(size, GFP_KERNEL); + n = kmemdup(e820_table_firmware, size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820_table_firmware, size); e820_table_firmware = n; } -- 1.8.3.1