From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F4B9C433E6 for ; Fri, 12 Feb 2021 13:11:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5FB8E64DA8 for ; Fri, 12 Feb 2021 13:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231308AbhBLNLH (ORCPT ); Fri, 12 Feb 2021 08:11:07 -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--