Re: [PATCH] spi: spidev_test: Fix input file check when transferring file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Michal
On Friday, November 04, 2016 11:30:03 AM Michal Vokáč wrote:
> Check the input file fd instead of spidev fd.
> The spidev fd is supposed to be OK otherwise the transfer_file() function
> would not be called at all.
> 
> Signed-off-by: Michal Vokáč <vokac.m@xxxxxxxxx>
> ---
>  tools/spi/spidev_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c
> index f046b77..816f119 100644
> --- a/tools/spi/spidev_test.c
> +++ b/tools/spi/spidev_test.c
> @@ -315,7 +315,7 @@ static void transfer_file(int fd, char *filename)
>  		pabort("can't stat input file");
>  
>  	tx_fd = open(filename, O_RDONLY);
> -	if (fd < 0)
> +	if (tx_fd < 0)
>  		pabort("can't open input file");
>  
>  	tx = malloc(sb.st_size);
> 
Good catch. That is definitely a bug in the previous code.

Reviewed-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux