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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 24 Apr 2008 09:35:09 +0200
From:	Roel Kluin <12o3l@...cali.nl>
To:	dbrownell@...rs.sourceforge.net,
	spi-devel-general@...ts.sourceforge.net
CC:	lkml <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2 v2] xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe()

Joe Perches wrote:
> On Wed, 2008-04-23 at 22:55 +0200, Roel Kluin wrote:

>> -	xspi->irq = platform_get_irq(dev, 0);
>> -	if (xspi->irq < 0) {
>> -		ret = -ENXIO;
>> +	ret = platform_get_irq(dev, 0);
>> +	if (ret < 0)
>>  		goto unmap_io;
>> -	}
>> +
>> +	xspi->irq = ret;
>> +	ret = 0;
> 
> Is the only negative return from platform_get_irq ENXIO?
> I think you still need the ret = -ENXIO before the goto.
> 
> Also, you don't need the ret = 0 line, it's set again
> a few lines below.
> 
> I think you should end up with:
> 
> 	ret = platform_get_irq(dev, 0);
> 	if (ret < 0) {
> 		ret = -ENXIO;
> 		goto unmap_io;
> 	}
> 
> 	xspi->irq = ret;
> 
> cheers, Joe

In that case, this should suffice,

thanks again,

Roel
---
xilinx_spi->irq is unsigned, so the test fails

Signed-off-by: Roel Kluin <12o3l@...cali.nl>
---
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index cf6aef3..2a471b3 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -353,11 +353,12 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
 		goto put_master;
 	}
 
-	xspi->irq = platform_get_irq(dev, 0);
-	if (xspi->irq < 0) {
+	ret = platform_get_irq(dev, 0);
+	if (ret < 0) {
 		ret = -ENXIO;
 		goto unmap_io;
 	}
+	xspi->irq = ret;
 
 	master->bus_num = pdata->bus_num;
 	master->num_chipselect = pdata->num_chipselect;
--
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