From patchwork Fri Jul 6 21:23:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10512545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6900A6024A for ; Fri, 6 Jul 2018 21:23:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 577AA287E0 for ; Fri, 6 Jul 2018 21:23:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B802287EF; Fri, 6 Jul 2018 21:23:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E515C287E0 for ; Fri, 6 Jul 2018 21:23:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A8F62203B99A8; Fri, 6 Jul 2018 14:23:32 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.221.67; helo=mail-wr1-f67.google.com; envelope-from=osalvador.vilardaga@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1EDC5202E5474 for ; Fri, 6 Jul 2018 14:23:31 -0700 (PDT) Received: by mail-wr1-f67.google.com with SMTP id r16-v6so5367949wrt.11 for ; Fri, 06 Jul 2018 14:23:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=thi0DSX2sAOi0pFHz7c9yxGly7b6YkqtJDRpM9XbMx4=; b=n5yXokz5T7ie4txThv0yP7Jl7KXoYtZqPSTaKCSI+0zIr9Zk8PKcpO+QbRMNY/rVmr 8ujVorhBCuN49C53AXqqdLD4K0Ow5GaPIcyyUS2ubGMKxB0VDz5hEkfkC0KhWMzTskk6 w89jtJCr7zD5mciN8plvlbpPDclyfdH63kN9dWl7Zrsoi9Asj7rCrwy31kwQIsyUk2pK c05BvFo6tmdz5urItCEYnCla3H6theOv1fTTDk+QHgyNeJO/2ddbDcGzz+WKu+O292IX iwGqMA2jw2/8bLB66FeayaIdA04Y1PJwWZz4Zcdykv821mqTY7qEtEdOUSq+JFuYskrl O8Ug== X-Gm-Message-State: APt69E2673wuUKwg8mmk5Idtfk//xuhDTM27qSauHBkqrpuBHKX2Fg96 +V/BwJHX/JyfoF7uWmuuPu4= X-Google-Smtp-Source: AAOMgpf6fgRTQpUtW2a5uLxh05qd2gJ9mlb5NeWNZ57bK3kQb6sxgO6zV8ErmtY5FsCq7kRgQmH3Sg== X-Received: by 2002:adf:af45:: with SMTP id z63-v6mr8260090wrc.238.1530912209268; Fri, 06 Jul 2018 14:23:29 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id p4-v6sm9177143wrj.71.2018.07.06.14.23.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jul 2018 14:23:28 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id B1966123C48; Fri, 6 Jul 2018 23:23:27 +0200 (CEST) Date: Fri, 6 Jul 2018 23:23:27 +0200 From: Oscar Salvador To: Ross Zwisler Subject: Re: [PATCH] mm/sparse.c: fix error path in sparse_add_one_section Message-ID: <20180706212327.GA10824@techadventures.net> References: <20180706190658.6873-1-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180706190658.6873-1-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , bhe@redhat.com, linux-nvdimm@lists.01.org, Dave Hansen , LKML , pasha.tatashin@oracle.com, Linux MM , "Kirill A. Shutemov" , Andrew Morton , Vlastimil Babka , osalvador@suse.de Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 06, 2018 at 01:06:58PM -0600, Ross Zwisler wrote: > The following commit in -next: > > commit 054620849110 ("mm/sparse.c: make sparse_init_one_section void and > remove check") > > changed how the error handling in sparse_add_one_section() works. > > Previously sparse_index_init() could return -EEXIST, and the function would > continue on happily. 'ret' would get unconditionally overwritten by the > result from sparse_init_one_section() and the error code after the 'out:' > label wouldn't be triggered. My bad, I missed that. > diff --git a/mm/sparse.c b/mm/sparse.c > index 9574113fc745..d254bd2d3289 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -753,8 +753,12 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat, > * plus, it does a kmalloc > */ > ret = sparse_index_init(section_nr, pgdat->node_id); > - if (ret < 0 && ret != -EEXIST) > - return ret; > + if (ret < 0) { > + if (ret == -EEXIST) > + ret = 0; > + else > + return ret; > + } sparse_index_init() can return: -ENOMEM, -EEXIST or 0. So what about this?: SUSE L3 diff --git a/mm/sparse.c b/mm/sparse.c index f55e79fda03e..eb188eb6b82d 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -770,6 +770,7 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat, ret = sparse_index_init(section_nr, pgdat->node_id); if (ret < 0 && ret != -EEXIST) return ret; + ret = 0; Does this look more clean? -- Oscar Salvador