From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 884F3C432C2 for ; Thu, 26 Sep 2019 07:47:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E57F21A4A for ; Thu, 26 Sep 2019 07:47:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E57F21A4A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0EE266B026A; Thu, 26 Sep 2019 03:47:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09EF76B026B; Thu, 26 Sep 2019 03:47:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 002AC6B026C; Thu, 26 Sep 2019 03:47:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id D66256B026A for ; Thu, 26 Sep 2019 03:47:20 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 5B182824CA3D for ; Thu, 26 Sep 2019 07:47:20 +0000 (UTC) X-FDA: 75976291440.22.mist27_5d6a416acb4d X-HE-Tag: mist27_5d6a416acb4d X-Filterd-Recvd-Size: 2120 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 07:47:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D3F94AE0C; Thu, 26 Sep 2019 07:47:18 +0000 (UTC) Date: Thu, 26 Sep 2019 09:47:18 +0200 From: Michal Hocko To: Oscar Salvador Cc: Alastair D'Silva , alastair@d-silva.org, Andrew Morton , David Hildenbrand , Pavel Tatashin , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] memory_hotplug: Add a bounds check to __add_pages Message-ID: <20190926074718.GF20255@dhcp22.suse.cz> References: <20190926013406.16133-1-alastair@au1.ibm.com> <20190926013406.16133-2-alastair@au1.ibm.com> <20190926073951.GA17200@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190926073951.GA17200@linux> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 26-09-19 09:40:05, Oscar Salvador wrote: > On Thu, Sep 26, 2019 at 11:34:05AM +1000, Alastair D'Silva wrote: > > From: Alastair D'Silva > > @@ -291,6 +307,10 @@ int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages, > > unsigned long nr, start_sec, end_sec; > > struct vmem_altmap *altmap = restrictions->altmap; > > > > + err = check_hotplug_memory_addressable(pfn, nr_pages); > > + if (err) > > + return err; > > + > > I am probably off here because 1) I am jumping blind in a middle of a discussion and > 2) I got back from holydays yesterday, so bear with me. > > Would not be better to just place the check in add_memory_resource instead? This was the previous version of the patch. The argument is that we do not want each add_pages user to think of this special handling. -- Michal Hocko SUSE Labs