lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 20 Apr 2010 11:11:08 +0200
From:	Hector Palacios <hector.palacios@...i.com>
To:	<dbrownell@...rs.sourceforge.net>
CC:	<linux-kernel@...r.kernel.org>,
	Hector Palacios <hector.palacios@...i.com>
Subject: [PATCH] spi: spidev_test gives error upon 1-byte transfer

The sample application spidev_test.c is using SPI_IOC_MESSAGE
ioctl to do an SPI transfer. This ioctl returns the number of
bytes successfully transmitted or a negative error code upon
erroneous completion. The application however is returning an
error if the result of the ioclt if the return value is 1.
This makes the application to fail upon 1-byte length transfers.

Signed-off-by: Hector Palacios <hector.palacios@...i.com>
---
 Documentation/spi/spidev_test.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c
index c1a5aad..8c9d02e 100644
--- a/Documentation/spi/spidev_test.c
+++ b/Documentation/spi/spidev_test.c
@@ -58,7 +58,7 @@ static void transfer(int fd)
 	};
 
 	ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
-	if (ret == 1)
+	if (ret < 1)
 		pabort("can't send spi message");
 
 	for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
-- 
1.7.0.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ