Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4148399pxb; Mon, 1 Feb 2021 13:53:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPoae1YtUM4WsIwlILQPx9xtIvymAiQ/wBGvVsHkW4aW4hpEVOvz1khS9wV7MlgVE8M+lG X-Received: by 2002:a05:6402:5207:: with SMTP id s7mr12004807edd.311.1612216391006; Mon, 01 Feb 2021 13:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612216390; cv=none; d=google.com; s=arc-20160816; b=xcuR82A4R6+2DD/oOCseybsPwIkirsAOBJsAbx8zae9T/nyZ11z7OUo/fCxibB3RmQ GAoREPi+oBeCqAte2/6aXnnNGp4HXgZ0hWpXdXGecFeoB5ZG+r9h++bi7b/ywYq0A6vu 3Sn76r5S+GntajfLhmHlFpUIpAz+JnjgklKnTyMNROStR3c30sBRNbbdOwdNV2/el6H9 CwwF7CK4nMHHXwd0dd9uscJA8fA3GnVyxoG6AEl5Ft+7TIVi+MQQ3P6hQ+998nzY+GB8 yQKlWfYFKLMMJ0tdxVTvHCSIVcf93W7gGjiApG78HqyLIc0DxI84gE6ISI3HE4NKdlvx WV4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=X0Q/ZUQ4hKoawWN2B+locX1+Bltm6iYAtS5TX76PGV0=; b=aANj/KSJHYfomDHv2TcMYax++sW743TMk96kQVDtzdrqXtxQBDkKWYxo3ySs+2pSDR Jk6QX+NPlMpUXi7Hh7S1zfF97aFYoYxwIm/wkjqASRMT1RiJWdeOIs8iBNkDMwNX0R2p HmOh+U8+xI9gRiLh9K0G9TFVLyJMfiuWLyieBj8Di2YoncKIXw/zAqDUpTd7zR07kU3C b9M5AbXpa8TZZPJA2wztLyUz/e4rLuk02rSLeQKfvZZ8x4yf3lggaHDnwSu1YMhhbSGq vSfW/llENi/Fmiywm37rmFZot5+iRNw4ve/BnVcOF1fP0EunUjC5FHdFQ0ykMefGiaeZ TYcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JcEV6HVa; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs42si1185512ejc.8.2021.02.01.13.52.46; Mon, 01 Feb 2021 13:53:10 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=JcEV6HVa; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbhBAVwB (ORCPT + 99 others); Mon, 1 Feb 2021 16:52:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbhBAVv7 (ORCPT ); Mon, 1 Feb 2021 16:51:59 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024D0C061573 for ; Mon, 1 Feb 2021 13:51:19 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id e19so12540918pfh.6 for ; Mon, 01 Feb 2021 13:51:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=X0Q/ZUQ4hKoawWN2B+locX1+Bltm6iYAtS5TX76PGV0=; b=JcEV6HVaeDaOOL0h5jY3uy6ve5Oys0MQOJ9U4nasE04exuRtFZbJpOIHVfWoYfle1J beI2sJhpCMqlNBKLZqSCeIYmtH728isIhOBGfVtCVebDEkV58CsHbbdI/9BFXOpwyhgi sPhuhxrbexd8U7yQKn0cHEHOHWqmMJ6kjMVmVst139NVTTYL8tb2UsrBxT/gZPOJhQTR bK3XnLbP8oRFa2gAPWEvZAP1vvQ7NrTtztwvuzEw5LaDNbCmxSFGSwPCx7byOdJRUt9C YTDIaUOkG8VOT/SQRV6U7po3pLvDqhE6/hv92a8C2KiIxOr0CrEWaO67fDJMNiOEuu4f 93zg== 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:in-reply-to:message-id :references:mime-version; bh=X0Q/ZUQ4hKoawWN2B+locX1+Bltm6iYAtS5TX76PGV0=; b=RiQAFXOOrJQm54cwkBs/zG/ZWMOasyQpRuQw+3ijlFBYILEt3eGoESVd5YxRJIFxpd FDUc8BLWSyAU5jdGnKryL6hbbs07KGOmVwI/Yl5DV34dyXVnoLW6kfzESYeXHtX98g3D uHAjrCaHrMu31jCE3WXnNZr6V87nPT1lcCdSRKfMcH8JyvlHMw/a9lUEudPF5MvGHsr6 4/YKSumchzOuo8GBi3+LZyWZbflzHTiqVIArvyzTdGGy81bOliCeXfqoDDxVW5UUL/zj d2NfUrs8z9mF8oHQV5kkw5tUoVUjab+yryVpZ19k7bO267HFRA+97ZNUz11guokcD2sz citw== X-Gm-Message-State: AOAM530TYIONyDkuesVP2x3+TaRrNUmAF6F4p+NHU4BXZO3QXD20qIQX Vo5VozQ2ixX0vynr/q+I70UXIxejXlTSSw== X-Received: by 2002:aa7:808b:0:b029:1ce:8a32:f5e8 with SMTP id v11-20020aa7808b0000b02901ce8a32f5e8mr3097800pff.34.1612216278371; Mon, 01 Feb 2021 13:51:18 -0800 (PST) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id a72sm20075000pfa.126.2021.02.01.13.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 13:51:17 -0800 (PST) Date: Mon, 1 Feb 2021 13:51:16 -0800 (PST) From: David Rientjes To: Ben Widawsky 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 In-Reply-To: <20210201165352.wi7tzpnd4ymxlms4@intel.com> Message-ID: <32f33dd-97a-8b1c-d488-e5198a3d7748@google.com> References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-4-ben.widawsky@intel.com> <234711bf-c03f-9aca-e0b5-ca677add3ea@google.com> <20210201165352.wi7tzpnd4ymxlms4@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2021, Ben Widawsky wrote: > 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? > Because the spec disallows it :)