Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp54949pxj; Thu, 3 Jun 2021 00:18:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP9mryiv2VxehLt8P5iAHDgIqU3O+4EVNzWNFb9gFZrkVic+HZZtB3LJ0Pyj3Vk/mhIQ/J X-Received: by 2002:a05:6402:1458:: with SMTP id d24mr20909560edx.85.1622704695989; Thu, 03 Jun 2021 00:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622704695; cv=none; d=google.com; s=arc-20160816; b=OygzqxRci7LDNM5jzssVYANIJ/i83QoZZfKSe6y2451coRimnJqhH4WDYqF8BmWWVl ar/bMUR/OCTVo4D9S1GTWk0Z34tkAtY3iicYgdVwSUD0UaS8eVdPm+Fax+QeOd56//Lk HAaPZ9TZe5fLz6t8UAXKV4DwFOnNhydeVkOoibFNrig92wrpAU4u00z1ItOtZ6Fz+AIS ENnPGdl9mC7vZFUw/DWz2DVVJwCTcZvCcVFawAYUb0EJ39GpiOqH38A4tOk+V8TA1FDF ewnjpEfQB9zX40QKmtKG3QGAy6G8U0tcQXrwD45+Z2bgE6Pnqa3kbqEkx/MLPixvHARj owJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=c39UDxYuwNEw0x3e7A1hpU3sFPkK2czrVNUjp/5WQ7Q=; b=KwmKGuafFozx/Oka9ByA1N9WmJ4q7+UH1+A50a1lGtnr2eMQDJMXPIsmNMJbfSP/ay wqqiS22gHdpFlzdKJ1wtwNLQDShmBTjHPYp1JABFd7fLdVy4wr1aEXRqA9XuZSPmO2Jv Jz+cVmj9lBSlXk6rdKnMDyXSkwXI7QvdFnOgx6+e7xJoOKa5pc3tNDr3WjJSjr5Soh3H oHq0YkKa8iOi53/RDAN8vupdkw6E6NSvsRYtoO2Gr7tEmJqJIpQExl0M8LX78GW0y5Q9 wc+wGYOm/E/OwCiVWR29sYaKEHYJCAUdpSbEcWInNusVPr01ce3MACK929eiRaO55NVB B5sQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si1763522edt.345.2021.06.03.00.17.52; Thu, 03 Jun 2021 00:18:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbhFCHSl (ORCPT + 99 others); Thu, 3 Jun 2021 03:18:41 -0400 Received: from verein.lst.de ([213.95.11.211]:60680 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhFCHSl (ORCPT ); Thu, 3 Jun 2021 03:18:41 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 7865B6736F; Thu, 3 Jun 2021 09:16:54 +0200 (CEST) Date: Thu, 3 Jun 2021 09:16:54 +0200 From: Christoph Hellwig To: Daniel Wagner Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Subject: Re: [PATCH] nvme: verify MNAN value if ANA is enabled Message-ID: <20210603071654.GA4536@lst.de> References: <20210531103651.109426-1-dwagner@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210531103651.109426-1-dwagner@suse.de> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -2972,6 +2972,16 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) > if (ret < 0) > goto out_free; > > +#ifdef CONFIG_NVME_MULTIPATH > + if (ctrl->ana_log_buf && (!ctrl->max_namespaces || > + ctrl->max_namespaces > le32_to_cpu(id->nn))) { > + dev_err(ctrl->device, > + "Invalid MNAN value %u\n", ctrl->max_namespaces); > + ret = -EINVAL; > + goto out_free; > + } > +#endif Please move the check into nvme_mpath_init_identify, where we can avoid the ifdef and the ana_log_buf check, which won't trigger for the first initialization.