dect
/
linux-2.6
Archived
13
0
Fork 0

[SCSI] gdth: Add missing call to gdth_ioctl_free

Add missing call to gdth_ioctl_free before aborting.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression buf,ha,len,addr,E;
@@

buf = gdth_ioctl_alloc(ha, len, FALSE, &addr)
... when != false buf != NULL
    when != true buf == NULL
    when != \(E = buf\|buf = E\)
    when != gdth_ioctl_free(ha, len, buf, addr)
*return ...;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
Julia Lawall 2010-12-29 15:57:54 +01:00 committed by James Bottomley
parent 8f4bfadd20
commit 5c10007560
2 changed files with 15 additions and 5 deletions

View File

@ -4273,8 +4273,10 @@ static int ioc_general(void __user *arg, char *cmnd)
}
rval = __gdth_execute(ha->sdev, &gen.command, cmnd, gen.timeout, &gen.info);
if (rval < 0)
if (rval < 0) {
gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr);
return rval;
}
gen.status = rval;
if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf,

View File

@ -365,8 +365,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
len = 0;
begin = pos;
}
if (pos > offset + length)
if (pos > offset + length) {
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
goto stop_output;
}
}
}
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
@ -450,8 +452,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
len = 0;
begin = pos;
}
if (pos > offset + length)
if (pos > offset + length) {
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
goto stop_output;
}
} while (drv_no != -1);
if (is_mirr) {
@ -472,8 +476,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
len = 0;
begin = pos;
}
if (pos > offset + length)
if (pos > offset + length) {
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
goto stop_output;
}
}
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
@ -542,8 +548,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
len = 0;
begin = pos;
}
if (pos > offset + length)
if (pos > offset + length) {
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
goto stop_output;
}
}
}
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);