Skip to contentSkip to conversation

firewire: fw_device_init: ‘minor��� may be used uninitialized

PATCH Superseded Tim Gardner 3 participants 5 messages Feb 18, 2013 – Feb 19, 2013 Firewire

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firewire: fw_device_init: ‘minor��� may be used uninitialized

'firewire: convert to idr_alloc()' accidentally orphaned 'minor'.

drivers/firewire/core-device.c: In function ‘fw_device_init’:
drivers/firewire/core-device.c:1029:24: warning: ‘minor’ may be used uninitialized in this function [-Wuninitialized]

---

If this patch is correct, then it also ought to go to stable if it misses 3.8 final.

 drivers/firewire/core-device.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/firewire/core-device.c +3 -2
index b946330..03ce7d9 100644
@@ -1017,10 +1017,11 @@ static void fw_device_init(struct work_struct *work)
 
 	fw_device_get(device);
 	down_write(&fw_device_rwsem);
-	ret = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS, GFP_KERNEL);
+	minor = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS,
+			GFP_KERNEL);
 	up_write(&fw_device_rwsem);
 
-	if (ret < 0)
+	if (minor < 0)
 		goto error;
 
 	device->device.bus = &fw_bus_type;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 firewire: fw_device_init: 'minor' may be used uninitialized

'firewire: convert to idr_alloc()' accidentally orphaned 'minor'.

drivers/firewire/core-device.c: In function ‘fw_device_init’:
drivers/firewire/core-device.c:1029:24: warning: ‘minor’ may be used uninitialized in this function [-Wuninitialized]

---

If this patch is correct, then it also ought to go to stable if it misses 3.8 final.

v2 - Better commit subject

 drivers/firewire/core-device.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/firewire/core-device.c +3 -2
index b946330..03ce7d9 100644
@@ -1017,10 +1017,11 @@ static void fw_device_init(struct work_struct *work)
 
 	fw_device_get(device);
 	down_write(&fw_device_rwsem);
-	ret = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS, GFP_KERNEL);
+	minor = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS,
+			GFP_KERNEL);
 	up_write(&fw_device_rwsem);
 
-	if (ret < 0)
+	if (minor < 0)
 		goto error;
 
 	device->device.bus = &fw_bus_type;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/1 firewire: fw_device_init: 'minor' may be used uninitialized

Date: Mon, 18 Feb 2013 14:24:36 -0700
From: Tim Gardner <[email protected]>

'firewire: convert to idr_alloc()' accidentally orphaned 'minor'.

drivers/firewire/core-device.c: In function ‘fw_device_init’:
drivers/firewire/core-device.c:1029:24: warning: ‘minor’ may be used uninitialized in this function [-Wuninitialized]

---
Andrew, please send this on together with the other idr patches, or even merge this into patch "firewire: convert to idr_alloc()" before the latter reaches upstream.

 drivers/firewire/core-device.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/firewire/core-device.c +3 -2
index b946330..03ce7d9 100644
@@ -1017,10 +1017,11 @@ static void fw_device_init(struct work_struct *work)
 
 	fw_device_get(device);
 	down_write(&fw_device_rwsem);
-	ret = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS, GFP_KERNEL);
+	minor = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS,
+			GFP_KERNEL);
 	up_write(&fw_device_rwsem);
 
-	if (ret < 0)
+	if (minor < 0)
 		goto error;
 
 	device->device.bus = &fw_bus_type;
Signature · 3 lines
Stefan Richter
-=====-===-= --=- =--==
http://arcgraph.de/sr/
Acked-by on v2 1/1
#3 lore raw

Re: [PATCH linux-next v2] firewire: fw_device_init: 'minor' may be used uninitialized

Quoted 10 lines · Stefan Richter

Date: Mon, 18 Feb 2013 14:24:36 -0700
From: Tim Gardner <[email protected]>

'firewire: convert to idr_alloc()' accidentally orphaned 'minor'.

drivers/firewire/core-device.c: In function ‘fw_device_init’:
drivers/firewire/core-device.c:1029:24: warning: ‘minor’ may be used uninitialized in this function [-Wuninitialized]

Sorry about that. :)

Signature · 1 line
tejun
#4 lore raw

Re: [PATCH linux-next v2] firewire: fw_device_init: 'minor' may be used uninitialized

In reply to Tim Gardner
Quoted 1 line · On Feb 18 Tim Gardner wrote:

'firewire: convert to idr_alloc()' accidentally orphaned 'minor'.

[...]

Quoted 2 lines

If this patch is correct, then it also ought to go to stable if it misses 3.8 final.

"firewire: convert to idr_alloc()" is pending for merge after 3.8/ before 3.9-rc1, IOW 3.8 is not affected. (I notified akpm who handles the faulty patch.)

Signature · 3 lines
Stefan Richter
-=====-===-= --=- =--==
http://arcgraph.de/sr/