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]
Message-ID: <1360242331-17025-1-git-send-email-abrodkin@synopsys.com>
Date:	Thu, 7 Feb 2013 17:05:31 +0400
From:	Alexey Brodkin <Alexey.Brodkin@...opsys.com>
To:	<linux-kernel@...r.kernel.org>
CC:	<grant.likely@...retlab.ca>, <Vineet.Gupta1@...opsys.com>,
	<arnd@...db.de>, Alexey Brodkin <Alexey.Brodkin@...opsys.com>
Subject: [PATCH] drivers/block/xsysace - revert "id" type from "u32" back to "int"

On addition of new device specified in devicetree device's "id" is set
by default to "-1" (it's in "of_device_add").

During probing of xsysace itself driver wants to determine his instance
number (used later for example for device naming). It is done simply by
reading "dev->id" (which is "-1" by default).

Then driver tries to get "id" from devicetree description reading
specific "port-number" property with "of_property_read_u32". And if no
property "port-number" was found "id" won't be changed (so if it was
"-1" it remains the same).

And later we check it with "if (id < 0) id = 0;" to escape negative
values.

But if "id" is "u32" it's always > 0 and later this value "-1" is used
for example for generation of device name. And instead of "xsa" it will
be "xs'" (ASCII "'" is "a" - 1). Which I believe is not expected.

Signed-off-by: Alexey Brodkin <abrodkin@...opsys.com>
---
 drivers/block/xsysace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 1f38643..32cc0a1 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1154,7 +1154,7 @@ static int ace_probe(struct platform_device *dev)
 {
 	resource_size_t physaddr = 0;
 	int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */
-	u32 id = dev->id;
+	int id = dev->id;
 	int irq = 0;
 	int i;
 
-- 
1.7.10.4

--
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