Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3961803pxb; Mon, 1 Feb 2021 08:58:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyERO7SztcHbFJHMb9o7lREVl4vscMlYIwv3k9fBRkCmr+ujSteu4G1KpMPVQZ7yZlGn74z X-Received: by 2002:aa7:c354:: with SMTP id j20mr2130483edr.351.1612198692536; Mon, 01 Feb 2021 08:58:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612198692; cv=none; d=google.com; s=arc-20160816; b=vbayslg9enCF8WZcCONrwsViW3Yk05U+nj+bS04c4eYQVR4kvd1yYYAMQg95jXE8M+ eOKYyUqV59gCg8erpekvJCT9tn4Epxco5LR10xHqNFDJ0PSsGl4eeT0Tv8bJ8KWPnIDU jzbZb7Gi1AJD20q5xLm1PVi57HJIaMoAUZBw/cdNvyd+E6W/Lp58nqCErC7jTub7Cdrh dTrYmblvcsJwafBaxqzQDrGfffq8oh6CNN8TaOH4B2dyOAk2EC7ZK6RC5E4cH3dzHBew Adk/LMIdIVf3/MKAgvXu02Zp1kMcmKtzfxzOIx4oBMukIO4SFVAiLR0SayS5EQzcoFTj 4Jdw== 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:from:date:ironport-sdr :ironport-sdr; bh=7qcuseAuL7my+UcbF2NasWLw1xwWKxfsziQXNHhLVPo=; b=GkkZPr5REq13HC9QdZGZOv75RuIcUDWDxKpQoFDKyM4yg4oAMylHlwzLM79EMeG1SR Gh1IF96hnKefw1X3SZlMZt1pmRedIMKa0FEZ7bN7N35dYEaae3nwY/9Nyc4Y/OKBE7oL pE5Dn2llMPHauZ9wLoQy4gCj85xTr4hICekEUZPaf7TSqA8pWiTmxXddAOOPfV5viOPB lbAZT3Daf11p1pWwBhf0NXqrgrISZh09nPWwtb+WnC5obxH0xpVVzls9+qFDazs2wJbx n1VRxL6uHCFROkIVaq/axPqdY8gB2TC97FunVDUQphtBxwTQPo7EvaT3P53EmrW8S6GZ H+9g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si11050423ejx.144.2021.02.01.08.57.47; Mon, 01 Feb 2021 08:58:12 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232026AbhBAQ5Q (ORCPT + 99 others); Mon, 1 Feb 2021 11:57:16 -0500 Received: from mga17.intel.com ([192.55.52.151]:37074 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbhBAQyj (ORCPT ); Mon, 1 Feb 2021 11:54:39 -0500 IronPort-SDR: puVpU2U83B+BucCklR/QKoplpkxfMK/0uevQChpr5jqdIIT5dFicaEy3jPzZCrFKNtbx99mcO+ 2LaP9ocHyLRQ== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="160481762" X-IronPort-AV: E=Sophos;i="5.79,393,1602572400"; d="scan'208";a="160481762" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 08:53:54 -0800 IronPort-SDR: yFSgEt+mhM9fBwFjcN56znWBQoTvbYdQbzSwOQKVq4azQE//8pACLBc8Kf3fRvPDCMHvmBG5Zs xWa6SNj8pZKA== X-IronPort-AV: E=Sophos;i="5.79,393,1602572400"; d="scan'208";a="577882409" Received: from jambrizm-mobl1.amr.corp.intel.com (HELO intel.com) ([10.252.133.15]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 08:53:53 -0800 Date: Mon, 1 Feb 2021 08:53:52 -0800 From: Ben Widawsky To: David Rientjes Cc: linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Chris Browy , Christoph Hellwig , Dan Williams , Ira Weiny , Jon Masters , Jonathan Cameron , Rafael Wysocki , Randy Dunlap , Vishal Verma , daniel.lll@alibaba-inc.com, "John Groves (jgroves)" , "Kelley, Sean V" Subject: Re: [PATCH 03/14] cxl/mem: Find device capabilities Message-ID: <20210201165352.wi7tzpnd4ymxlms4@intel.com> References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-4-ben.widawsky@intel.com> <234711bf-c03f-9aca-e0b5-ca677add3ea@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <234711bf-c03f-9aca-e0b5-ca677add3ea@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-01-30 15:51:49, David Rientjes wrote: > On Fri, 29 Jan 2021, Ben Widawsky wrote: > > > +static int cxl_mem_setup_mailbox(struct cxl_mem *cxlm) > > +{ > > + const int cap = cxl_read_mbox_reg32(cxlm, CXLDEV_MB_CAPS_OFFSET); > > + > > + cxlm->mbox.payload_size = > > + 1 << CXL_GET_FIELD(cap, CXLDEV_MB_CAP_PAYLOAD_SIZE); > > + > > + /* 8.2.8.4.3 */ > > + if (cxlm->mbox.payload_size < 256) { > > + dev_err(&cxlm->pdev->dev, "Mailbox is too small (%zub)", > > + cxlm->mbox.payload_size); > > + return -ENXIO; > > + } > > Any reason not to check cxlm->mbox.payload_size > (1 << 20) as well and > return ENXIO if true? If some crazy vendor wanted to ship a mailbox larger than 1M, why should the driver not allow it? I'm open to changing it, it just seems like a larger mailbox wouldn't be fatal.