Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2334243rdf; Mon, 6 Nov 2023 10:55:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwyTdsJQC3myxITdZEF4Vxijh2qviU2J1rX8Q/GQtjKIL8qRIZlwm+bLWIvpVbaYasUIfn X-Received: by 2002:a05:6a20:7485:b0:171:c88a:891e with SMTP id p5-20020a056a20748500b00171c88a891emr26112158pzd.55.1699296954239; Mon, 06 Nov 2023 10:55:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699296954; cv=none; d=google.com; s=arc-20160816; b=k/L8YojD1SE3NGItD89/fAiLKMOT6d8Txk1RU6mu67ayGdDJorryJxth44mD0ynpBo 0G9gnxWFphZgiBsrOV6o5DsftBuSu8bRFCo3eSqWiXhsY/tV8q2xVcAsJmoy30JwLVMj sgkvOwCVmftdSOcLmn5HTjvezMqaNRLWyHFVf+HlqxrFl3PbUAvg4tokK9PGmJ6584l9 WKUKUP82NknsUUJbaCnwIT4kRfF+fA15L+fF0dUxkP5bQORLOQjxmVQQJtHA9XzHHRJx rtnw8UztCrXtfpNUg+9qYua43xRqYzl8LTBsNs1rjAK7yfdETBzot3fR/HEgM+qEz4+B m2Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=vhLzSo2ZdsS1cNYMQVnH8qp5KlM4qInxdfA0/jF4QCI=; fh=7w9uPxh+OEjGpNsU67mHQv8KWA5BCn70WHx+nHLE/7o=; b=mXVQe+K5lL9auMNq/dX7wbvNcu4yJb/ogDydUXlpnpjm7AmANrZ/QfnTi/d+cX+Vck cHecZYBjzYjLa0sN9AIhxXtB4v141kVyHU6/QESS4EqxviDNec1JD2hDe+nNM4JZwoUK Fe34u+oVqKLrS0rC2D8rdAeAhLOZQec4AYsEEQ4rf/DwcR4LEye0MFz2bhSkGYKhnMUV 7UVVNpFJ6R66tbW6we84SGvKfzcmyJgOT69N/F528p8YBP3meEXcuqpuxCWaBVxKH9mL n8Q+UxDS7B3hGEkskW7s6rmKgW3A5nRYnpMKOBnaBcTKarv4zXVQWnTitLuFuhSc/b08 x8ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=khxgnuGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id cu20-20020a17090afa9400b00277387bc11dsi8405573pjb.188.2023.11.06.10.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 10:55:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=khxgnuGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 682A9807744C; Mon, 6 Nov 2023 10:55:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232132AbjKFSzJ (ORCPT + 99 others); Mon, 6 Nov 2023 13:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbjKFSzI (ORCPT ); Mon, 6 Nov 2023 13:55:08 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB77EA2; Mon, 6 Nov 2023 10:55:05 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-da37522a363so5080328276.0; Mon, 06 Nov 2023 10:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699296905; x=1699901705; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=vhLzSo2ZdsS1cNYMQVnH8qp5KlM4qInxdfA0/jF4QCI=; b=khxgnuGJ8j4BGXEo6Y+AnoFsHurQVgtv9XLQzlU4Un1+0sU2/6KWfCfkawt8or96ya 6bLiZDUiCdQcrkSGL5pRhinRSGh6JmPBPCsJK17jfDLJ14CCYOaOE+uTCT7E8dsinaoR ZVWIMS/cMj/mjOWXsYmNqHDBsO4PR9dju6f1up0jAf+/J23B1eUXraJXEHFEcVsVhNfy Jg8mdw+G2k1tJPxewDVAHNvcA1lJKSpO8YONkXB9yPChF5AuEGCm9gIcjysyzWXYSo+8 VaJAD4UtrCf+T404DevLSiBgpThZxYa71Llb1BQonVmAJMMlMCAnpSrbCDTRlXScoq6a qmAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699296905; x=1699901705; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vhLzSo2ZdsS1cNYMQVnH8qp5KlM4qInxdfA0/jF4QCI=; b=VZxHh4ttDCsfLPabi9hdqhpFG4/wW5/DiY/XtL8oOhWjoBMBMi6u4AOGwfAAj0M8Ax DL3blCkk03cHgOVnMu2xAAKKxmEWqvaGR0i928X9Sb3EGt1iGXMh4E7WRobItzmjAXwh 9xHEH/rmi4szFFo+2DSdozW1ePJ1PvW2tJlNJlaEth6dHW9q00ft6VxvNByAKrLm3s7V 9i4mq07a7b3WXPSqD1rS6Vgz/Wfo3iHfjm4MW1dJHWRvWXeSQElm3FAg6Lz3/5VdAw78 WD8WiYQsKH5S0YAtBEvyfwdx0rEDgrWRgoJ3uLW4EWDL4J+P+htGTNpLVfslN8fk704K mKYw== X-Gm-Message-State: AOJu0YxCc4MhY1OGBPNMsRnPWiqmNriTiOxpJ2qEgCNewK6yiWi6yYf2 /bbbLjA5ryrewGiqFEgIP9s= X-Received: by 2002:a5b:d49:0:b0:d9a:6301:c82b with SMTP id f9-20020a5b0d49000000b00d9a6301c82bmr31039102ybr.13.1699296905021; Mon, 06 Nov 2023 10:55:05 -0800 (PST) Received: from debian ([50.205.20.42]) by smtp.gmail.com with ESMTPSA id w142-20020a25c794000000b00da0c49a588asm4300672ybe.8.2023.11.06.10.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 10:55:04 -0800 (PST) From: fan X-Google-Original-From: fan Date: Mon, 6 Nov 2023 10:54:38 -0800 To: Vishal Verma Cc: Andrew Morton , David Hildenbrand , Oscar Salvador , Dan Williams , Dave Jiang , linux-kernel@vger.kernel.org, linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, Huang Ying , Dave Hansen , "Aneesh Kumar K.V" , Michal Hocko , Jonathan Cameron , Jeff Moyer Subject: Re: [PATCH v9 1/3] mm/memory_hotplug: replace an open-coded kmemdup() in add_memory_resource() Message-ID: References: <20231102-vv-kmem_memmap-v9-0-973d6b3a8f1a@intel.com> <20231102-vv-kmem_memmap-v9-1-973d6b3a8f1a@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231102-vv-kmem_memmap-v9-1-973d6b3a8f1a@intel.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 06 Nov 2023 10:55:19 -0800 (PST) On Thu, Nov 02, 2023 at 12:27:13PM -0600, Vishal Verma wrote: > A review of the memmap_on_memory modifications to add_memory_resource() > revealed an instance of an open-coded kmemdup(). Replace it with > kmemdup(). > > Cc: Andrew Morton > Cc: David Hildenbrand > Cc: Michal Hocko > Cc: Oscar Salvador > Cc: Dan Williams > Reported-by: Dan Williams > Reviewed-by: David Hildenbrand > Signed-off-by: Vishal Verma > --- Reviewed-by: Fan Ni > mm/memory_hotplug.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index f8d3e7427e32..6be7de9efa55 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1439,11 +1439,11 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) > if (mhp_flags & MHP_MEMMAP_ON_MEMORY) { > if (mhp_supports_memmap_on_memory(size)) { > mhp_altmap.free = memory_block_memmap_on_memory_pages(); > - params.altmap = kmalloc(sizeof(struct vmem_altmap), GFP_KERNEL); > + params.altmap = kmemdup(&mhp_altmap, > + sizeof(struct vmem_altmap), > + GFP_KERNEL); > if (!params.altmap) > goto error; > - > - memcpy(params.altmap, &mhp_altmap, sizeof(mhp_altmap)); > } > /* fallback to not using altmap */ > } > > -- > 2.41.0 >