Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2837998imm; Thu, 24 May 2018 17:15:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrKPwhkqHqK0tW/KWsArwq6Xx802SKUBjcBrwAeo0fvf8F2mnJ5yFx0gOI+QPu48pJrYmB3 X-Received: by 2002:a63:7e1a:: with SMTP id z26-v6mr120381pgc.339.1527207330066; Thu, 24 May 2018 17:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527207330; cv=none; d=google.com; s=arc-20160816; b=m9ZxQmbzgNkHC1uRl3tPRcsS0h+OILHMQntBRsagqX/bvNwXN7APE0Kk5sQOV4nCIz pgD91xxeSpOISVCejg3yS6rvuerKr7xa/nEbb0/lu2Q4q7w3eoNil59afYe7MxGmRbY6 6hJmR9GI4/85s5l9jGWzai9lU8mq19rvLpWz5zN1U/oD922lJlNBjCFf/U1YI7iLoczq xXHH/dxHesUCrZ24XAZJw2XdE7qaeT32rNZ8HvktCNPQ0oQsmQ/H84AIuzLEFi+ACkhn u/EeOzL6zoII1asCy4NK85OJyibs19W+uk53PG1jENYhUy330hwKnSyS8nOkQP8DIeRK BROg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=UnELsDQ+ke0Cm4d3HWWBwheL1VEozHQvrdvRVZnIUjg=; b=B2r4wZK2e0C+kxkKWFSU6Wu4aCWKnNDiXnsRNfheOySLspFlgS7rGi6eM7iuj0Cn5r XYLKZuhg7Q1e3Kvtmjtck4pItyn99JnCw+ikZGwe3JiTRBtoYB357WZcLwclEfVsg24S njstKldIE33wuFXlOMOdHsNDO2eI/8cHwMwhg6ykas04quVwPb4cJpiYOKHWHDGPnWWF tVp3Kdp/YFz4gsIcaJQT4swBZfZ56WPOqT7rdIUSTzTnhCFsmXn6MHLyjeCxchSh3cey AOxoW2zmWDRgfu2cwXH4MO0pb5HyMwWeo1P5WGPdjNVROY5avbjbDf3BDIeXcyBCW0UG UEvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Q7fWCXcD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v15-v6si29391pfl.233.2018.05.24.17.15.14; Thu, 24 May 2018 17:15:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Q7fWCXcD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970429AbeEXOL7 (ORCPT + 99 others); Thu, 24 May 2018 10:11:59 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40800 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966751AbeEXOLy (ORCPT ); Thu, 24 May 2018 10:11:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UnELsDQ+ke0Cm4d3HWWBwheL1VEozHQvrdvRVZnIUjg=; b=Q7fWCXcD+BeMulw99NLEF+fsq agYTQdtEAVNBReArq0dxf+CS/Tfi6mz13QevQtBoZeDvSEKCeri8oyy+dPCqflVE5/9syYsusCKsG S1x0br5U3gtl5RwxStjitc+UGciJ/R+iAD0MZG9oUNgTGz6l3V62dg4dyjFOi7wXivJ2FvnUC04Vp r6eodQrADxfAVDVpWThDTqmMQRgnWTPKezc3qCXXyUcKmrSxXi5musqVI9EAPNNu6cUTCG4dsKgvA mXmzVZmPmi61D6x8U/k3uakWzbiWrb9M4MXOB/UteNloDu+llL98ITMX0gxeeDk5Z8So2wNEF9RwG JSnlltIMw==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLqy0-0006Yg-6W; Thu, 24 May 2018 14:11:44 +0000 Date: Thu, 24 May 2018 07:11:44 -0700 From: Christoph Hellwig To: Kees Cook Cc: Jens Axboe , "Martin K. Petersen" , James Bottomley , Tejun Heo , Borislav Petkov , "David S. Miller" , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , linux-block@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] scsi: Check sense buffer size at build time Message-ID: <20180524141144.GA19629@infradead.org> References: <20180522181512.39316-1-keescook@chromium.org> <20180522181512.39316-7-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180522181512.39316-7-keescook@chromium.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +/* Make sure any sense buffer is the correct size. */ > +#define scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \ > + sshdr, timeout, retries, flags, rq_flags, resid) \ > +({ \ > + BUILD_BUG_ON((sense) != NULL && \ > + sizeof(sense) != SCSI_SENSE_BUFFERSIZE); \ > + __scsi_execute(sdev, cmd, data_direction, buffer, bufflen, \ > + sense, sshdr, timeout, retries, flags, rq_flags, \ > + resid); \ > +}) This macro gets evaluated in the scsi_execute_req inline function just below. So either we need to include scsi_sense.h/scsi_common.h in scsi_device.h, or just move scsi_execute_req out of line. The latter sounds better to me a it's not really used in a fast path.