From: Mark Brown Subject: Re: [PATCH v2] spi: core: Validate lenght of the transfers in message Date: Tue, 18 Feb 2014 09:09:38 +0900 Message-ID: <20140218000938.GE2669@sirena.org.uk> References: <1392444566-23605-1-git-send-email-iivanov@mm-sol.com> <20140216142512.GR4524@book.gsilab.sittig.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xJK8B5Wah2CMJs8h" Cc: "Ivan T. Ivanov" , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org To: Gerhard Sittig Return-path: Content-Disposition: inline In-Reply-To: <20140216142512.GR4524@book.gsilab.sittig.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-spi.vger.kernel.org --xJK8B5Wah2CMJs8h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Feb 16, 2014 at 03:25:12PM +0100, Gerhard Sittig wrote: > On Sat, Feb 15, 2014 at 08:09 +0200, Ivan T. Ivanov wrote: > - the total length of the SPI transfer cannot be empty (which I'd > consider an optimization, not a violation, and may need a > separate discussion) We probably want to allow that for people doing fun stuff with cs_change though I'm not convinced anything doing that is actually a good idea. > - the total length of the SPI transfer must be such that each > "word" must be provided within a full 1/2/4 byte entity, with > padding bits if the bits-per-word is "odd" > Is this a misunderstanding on my side? A terminology thing? To > me, the "SPI transfer" is the total payload and may have any > arbitrary length. What you check for is a constraint on the > transfer's length derived from or based on the "word length" > ('word' in SPI context). > So the code may be appropriate, yet the description may need an > update, to not have the next person ask the same questions again. It seems fairly clear to me - if we're transferring 16 bit words we need the transfer to me a multiple of 16 bits and so on? The requirement for padding is unclear I have to say. --xJK8B5Wah2CMJs8h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTAqS+AAoJELSic+t+oim92RUP/2YvBAHKWr2T3U8Xft3gbVdB B+FkgEIansZdOCHzqPIbrnXgEHhS16+0qjWa9/aD4EBxrAFI0hz0GptDZS+tbf93 X+uX8dGRZaDOp1QvNQmJjWCTualTOZiaDBmpLRKq8p39wJv6Hd5Bt02F3UJQ69Mn N9DWImmFWf32BVeuf0fwKom7XJWld5iAf4PpwDrRlzKumCDfqcAiB8wPiCwlAlwm w9EbiCYhM4fcJQFStPmZPXTYgH86oj0gi/e5kKw+lUaEIybILSJAAidpngMudSoJ 6R0lzQu77bTtb/gQ+UsiwrOCos5Q3dUenkvqdIaQEDZtVgzl6XSGh3zNqx7jfyd/ HCHL0O8DtnGzJxDXY2ZLea6dnYZmsEZTvuSuDoML43wJYk+I3gZoL7KzrLlCHkWK adZm2cBoot2NO5pfuxE294/WICSUE22KkYU7e+h1UFkpXd6T9jODkBo75OUX7FRH Ypz8kGLZ7XDmz22o2S244hPTfbs1xpGw0kwuuP/S3TatyRJKzzVfNYKGE2GX+Xat gwblF5P0m3XJ+UzAh5t4P6B9GCCdR3XocQv+d8JF+/7hVYPj+p8e8uwLwQ4Gdc1K 1dbdyC4mIqkw5DU1A1EaSdQVO2/kfTxf5pDgkznFr3Tc+fqxrPWMmpSa5xOPJhUB TsRjXJWxJ3PEI6zbszje =/2FT -----END PGP SIGNATURE----- --xJK8B5Wah2CMJs8h--