Re: [PATCH 3/8] Documentation/spi/spidev_test.c: accept input from a file

From: Mark Brown
Date: Tue Nov 17 2015 - 13:46:41 EST


On Tue, Nov 17, 2015 at 07:26:54PM +0100, Anton Bondarenko wrote:
> On 17.11.2015 16:24, Joshua Clayton wrote:

> >+ if (sb.st_size > 4096)
> >+ pabort("input file exceeds spidev's 4k limit");

> This is not a true. IIRC PAGE_SIZE is the default buffer size for spidev,
> but can be changed using bufsiz module parameter.
> Just 'insmod spidev bufsiz=X', where X is number of bytes.

Right, there's also various options for changing PAGE_SIZE on some
architectures. I was going to go and check what we actually do here but
in general it does seem better to just let the kernel worry about
validating things like this - it needs to do that anyway and it means
that if someone improves the kernel code to accept larger buffers then
the tool will automatically be able to use them instead of requiring
people to remember to separately update the tool.

Attachment: signature.asc
Description: PGP signature