Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c100075 authored by Julia Lawall's avatar Julia Lawall Committed by James Bottomley
Browse files

[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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 8f4bfadd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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, 
+12 −4
Original line number Diff line number Diff line
@@ -365,10 +365,12 @@ 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);

        if (!flag) {
@@ -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,9 +476,11 @@ 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);
        
        if (!flag) {
@@ -542,10 +548,12 @@ 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);
        
        if (!flag) {