2000-11-10 02:49:38

by Frank Davis

[permalink] [raw]
Subject: [test11-pre2] rrunner.c compiler error

Hello,
I received the following error while compiling test11-pre2:

rrunner.c : In function 'rr_ioctl'
rrunner.c:1558: label 'out' used but not defined
make[2]: *** [rrunner.o] Error 1
make[2]: Leaving directory '/usr/src/linux/drivers/net'
...
make: ** [mod_drivers] Error 2

out is located in the file, so I'm assuming its a bracing issue.

Regards,
Frank



2000-11-10 03:08:33

by Alan

[permalink] [raw]
Subject: Re: [test11-pre2] rrunner.c compiler error

> rrunner.c : In function 'rr_ioctl'
> rrunner.c:1558: label 'out' used but not defined
> make[2]: *** [rrunner.o] Error 1

My fault. Swap that 1158 line pair

error = -EPERM;
goto out;

with
return -EPERM

Subject: [PATCH] Re: [test11-pre2] rrunner.c compiler error

On Fri, 10 Nov 2000, Alan Cox wrote:
> > rrunner.c : In function 'rr_ioctl'
> > rrunner.c:1558: label 'out' used but not defined
> > make[2]: *** [rrunner.o] Error 1
>
> My fault. Swap that 1158 line pair
>
> error = -EPERM;
> goto out;
>
> with
> return -EPERM
>

There is also line 1566 with "goto out;" (out of memory case).
Complete bugfix:

--- linux-240t11p2/drivers/net/rrunner.c Fri Nov 10 14:28:43 2000
+++ linux/drivers/net/rrunner.c Fri Nov 10 14:50:37 2000
@@ -1554,16 +1554,14 @@
switch(cmd){
case SIOCRRGFW:
if (!capable(CAP_SYS_RAWIO)){
- error = -EPERM;
- goto out;
+ return -EPERM;
}

image = kmalloc(EEPROM_WORDS * sizeof(u32), GFP_KERNEL);
if (!image){
printk(KERN_ERR "%s: Unable to allocate memory "
"for EEPROM image\n", dev->name);
- error = -ENOMEM;
- goto out;
+ return -ENOMEM;
}

spin_lock(&rrpriv->lock);

--
Bartlomiej Zolnierkiewicz
<[email protected]>

2000-11-10 14:28:54

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] Re: [test11-pre2] rrunner.c compiler error

Index: drivers/net/rrunner.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/rrunner.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 rrunner.c
--- drivers/net/rrunner.c 2000/11/10 02:09:10 1.1.1.4
+++ drivers/net/rrunner.c 2000/11/10 14:21:01
@@ -1550,36 +1550,29 @@

rrpriv = (struct rr_private *)dev->priv;

-
switch(cmd){
case SIOCRRGFW:
- if (!capable(CAP_SYS_RAWIO)){
- error = -EPERM;
- goto out;
- }
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;

image = kmalloc(EEPROM_WORDS * sizeof(u32), GFP_KERNEL);
if (!image){
printk(KERN_ERR "%s: Unable to allocate memory "
"for EEPROM image\n", dev->name);
- error = -ENOMEM;
- goto out;
+ return -ENOMEM;
}

spin_lock(&rrpriv->lock);

if (rrpriv->fw_running){
printk("%s: Firmware already running\n", dev->name);
- kfree(image);
error = -EPERM;
goto out_spin;
}

i = rr_read_eeprom(rrpriv, 0, image, EEPROM_BYTES);
if (i != EEPROM_BYTES){
- kfree(image);
- printk(KERN_ERR "%s: Error reading EEPROM\n",
- dev->name);
+ printk(KERN_ERR "%s: Error reading EEPROM\n", dev->name);
error = -EFAULT;
goto out_spin;
}
@@ -1591,9 +1584,8 @@
return error;

case SIOCRRPFW:
- if (!capable(CAP_SYS_RAWIO)){
+ if (!capable(CAP_SYS_RAWIO))
return -EPERM;
- }

image = kmalloc(EEPROM_WORDS * sizeof(u32), GFP_KERNEL);
if (!image){
@@ -1604,18 +1596,21 @@

oldimage = kmalloc(EEPROM_WORDS * sizeof(u32), GFP_KERNEL);
if (!oldimage){
+ kfree(image);
printk(KERN_ERR "%s: Unable to allocate memory "
"for old EEPROM image\n", dev->name);
return -ENOMEM;
}

error = copy_from_user(image, rq->ifr_data, EEPROM_BYTES);
- if (error)
- error = -EFAULT;
+ if (error) {
+ kfree(image);
+ kfree(oldimage);
+ return -EFAULT;
+ }

spin_lock(&rrpriv->lock);
if (rrpriv->fw_running){
- kfree(image);
kfree(oldimage);
printk("%s: Firmware already running\n", dev->name);
error = -EPERM;
@@ -1652,6 +1647,7 @@
}

out_spin:
+ kfree(image);
spin_unlock(&rrpriv->lock);
return error;
}


Attachments:
rrunner.patch (2.13 kB)