Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2926397pxb; Fri, 12 Feb 2021 05:14:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeUUU5l+f1ZK5dDMSDjVstwh9kONSLmH43TcWBwIh3RKWYKCHfO7OpQ+99fuHyG66Y9vMv X-Received: by 2002:a05:6402:54b:: with SMTP id i11mr3276732edx.262.1613135640301; Fri, 12 Feb 2021 05:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613135640; cv=none; d=google.com; s=arc-20160816; b=FLDtOjR0n80bssu9DQ/LVsnKyrdF8aLW5dTDuRwj22CTS5ZLrK/nzTXWBtidhVXcnL HDZtqYy3kh1NcgSJyXyBRPXXLwxJ50Zd48HFdu9WIuQeX9Ea3uzDuWQgNXO0HRcQOt8Q 7ofJwFXh76ymYolPIr3/fHtvrlvDzOXCpbDA/NmAGgIMH9QGMHTlXmevwtJYDSPYlyBP plnyaVqD9ifQD1I5EWnaPCqdLIEV1yXilYU2i7HuaqjZ9g9TYkdgVD3VcdtEI12B+E+W hgyKaMsqVNYlTF/4zjMx2w1SgbFtapfIyF+ZkXiQLOlz51tZ4ZiMkN9wIIjTcfCDE6EH zAqA== 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 :dkim-signature; bh=PIz2VKnQQfe63q6GVhuZvWZ7oh55+NSmdDRgtOE1Apo=; b=vtCFPzcszaY3aCruaJP5Uh3M4bUrh3oHHenTCkr8ZzKXcsLLQHJHn6/RjhMFlxzs1B cccGIV7Gq173jbeeOPz4c4FJY7Sr2A+24vbhFn8bh5ekbO09Eydf0WiywXLEOPnfg5IA AGlfS9CYhmI+SrRion2fWPUyOmOB4TPgsoxL6IfW5msgpESEuqBMS2YrENTDMyqCihih 0g+kT/drv0/xzUiLn8jo5QUVjD71ftb7pzBQt5Go1M9IvwYvRv67O40AiTpcfW7hxK/o +SDG44a0KgmClE18I4Bj7hVhtnTvgtiLzku6RXwdT51GEyP3BTQ0o8mlCggwWgeq/lsi zSJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hpC7QL6j; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si6003274ejc.209.2021.02.12.05.13.37; Fri, 12 Feb 2021 05:14:00 -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=@kernel.org header.s=k20201202 header.b=hpC7QL6j; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbhBLNKx (ORCPT + 99 others); Fri, 12 Feb 2021 08:10:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:58618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbhBLMxz (ORCPT ); Fri, 12 Feb 2021 07:53:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E756B64E3D; Fri, 12 Feb 2021 12:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613134395; bh=VCJx0lwRP7/ayaI+l7U/bQLKw4DO20YRWTzkvFp0K7s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hpC7QL6jT2mB4XRWKhADpkJe+y56iWYj8DVZGPgYAZS4Dvc0XgK+PPKOwTUE7iK8i ka1oBNXo8P6N0XQLfhMIAiP0tAfALvZfhAdKnq6mu40IxVArBXj2XAjtdGjmnB2JZq TBAXF63qeZLpmrnsIk3f5NmEP5EAwwr1Mb8eqYTL8Q17z/FCBO3kR9mdWUs8Ne8KwF NYHxIevaOl+5KPdFJUq49dpO5toVCSRuyRKIRI4J0KhrGt8IZ/OsXpfA2mEGlUJeTi Gh8wt/wEjmDX35+Chm8MwLrr94MVRbaaoAIQpwC8k+iBhEr0ABV/J1vx4nkDZ7LtIs 5IJfRKdaqDEYA== Date: Fri, 12 Feb 2021 12:52:21 +0000 From: Mark Brown To: Nicolas Saenz Julienne Cc: Robin Murphy , Phil Elwell , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message() Message-ID: <20210212125221.GD6057@sirena.org.uk> References: <20210211180820.25757-1-nsaenzjulienne@suse.de> <20210212123118.GB6057@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sgneBHv3152wZ8jf" Content-Disposition: inline In-Reply-To: X-Cookie: One size fits all. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --sgneBHv3152wZ8jf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 12, 2021 at 01:48:21PM +0100, Nicolas Saenz Julienne wrote: > On Fri, 2021-02-12 at 12:31 +0000, Mark Brown wrote: > > On Thu, Feb 11, 2021 at 07:08:20PM +0100, Nicolas Saenz Julienne wrote: > > > - if (xfer->tx_buf || xfer->rx_buf) { > > > + if ((xfer->tx_buf || xfer->rx_buf) && xfer->len) { > > I think the issue here is more that some users were passing in buffers > > with zero length transfers, the above check was already intended to > > catch this case but was working on the assumption that if there was > > nothing to transfer then no buffer would be provided. > Fair enough, maybe it makes sense to move the check into __spi_validate() and > propagate an error upwards? No, I think it's fine - there's probably some sensible use case with drivers reusing a statically allocated transfer/buffer set for multiple operations and just tweaking the length as needed which seems a bit weird but I can't think of a reason not to allow it. Your patch is currently queued, all being well it'll get tested & pushed out later today. --sgneBHv3152wZ8jf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmAmegQACgkQJNaLcl1U h9A3mgf+LfhWDYBCt2tDRH4CJLx9uR90z5TVZ+yjLbTtT+Ybj8EQg3xGkKZt2WCc lLMlIEBfWn26ufScsEanrofysJ+PQCH4uD9y5+hckM36BVbl29yvrnUAo41F9nw6 IHqGt7K5KSjr3F4rP2o0rWtVFtU1/AhvPvyAZMRbc4clxRzVNToCg1xQTEmgtysb fDgY70NmLVKE8XVlD4TJXYaaICCXAsVBWdyilCEIM1fTLiREEL9ROmDDX8GyiPiw ZJ1FYqv7kbtSENZzNpZWZ7dCRr8S0iRyT0CU2x8ZkyVKF7NM45BYh//mc3313IvX WD+zTWzaBOyW+q0pq208nOTqCkbVFQ== =iCJf -----END PGP SIGNATURE----- --sgneBHv3152wZ8jf--