• Julia Lawall's avatar
    drivers/ata/sata_dwc_460ex.c: add missing kfree · a081da63
    Julia Lawall authored
    Currently, error handling code in this function calls the function
    sata_dwc_port_stop, but this function has essentially no effect if hsdevp
    has not been stored in ap, which is the case throughout this function.  The
    only effect is to print a debugging message including ap->print_id.
    
    The code is rewritten to not call sata_dwc_port_stop, but instead to jump
    to a local label that prints the original error message and the print_id
    information.  In the case where hsdevp has been already allocated (but not
    yet stored in ap), this value is freed as well.
    
    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)
    
    // <smpl>
    @exists@
    local idexpression x;
    statement S,S1;
    expression E;
    identifier fl;
    expression *ptr != NULL;
    @@
    
    x = \(kmalloc\|kzalloc\|kcalloc\)(...);
    ...
    if (x == NULL) S
    <... when != x
         when != if (...) { <+...kfree(x)...+> }
         when any
         when != true x == NULL
    x->fl
    ...>
    (
    if (x == NULL) S1
    |
    if (...) { ... when != x
                   when forall
    (
     return \(0\|<+...x...+>\|ptr\);
    |
    * return ...;
    )
    }
    )
    // </smpl>
    Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
    Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
    a081da63
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
acard-ahci.c Loading commit data...
ahci.c Loading commit data...
ahci.h Loading commit data...
ahci_platform.c Loading commit data...
ata_generic.c Loading commit data...
ata_piix.c Loading commit data...
libahci.c Loading commit data...
libata-acpi.c Loading commit data...
libata-core.c Loading commit data...
libata-eh.c Loading commit data...
libata-pmp.c Loading commit data...
libata-scsi.c Loading commit data...
libata-sff.c Loading commit data...
libata-transport.c Loading commit data...
libata-transport.h Loading commit data...
libata.h Loading commit data...
pata_acpi.c Loading commit data...
pata_ali.c Loading commit data...
pata_amd.c Loading commit data...
pata_arasan_cf.c Loading commit data...
pata_artop.c Loading commit data...
pata_at32.c Loading commit data...
pata_at91.c Loading commit data...
pata_atiixp.c Loading commit data...
pata_atp867x.c Loading commit data...
pata_bf54x.c Loading commit data...
pata_cmd640.c Loading commit data...
pata_cmd64x.c Loading commit data...
pata_cs5520.c Loading commit data...
pata_cs5530.c Loading commit data...
pata_cs5535.c Loading commit data...
pata_cs5536.c Loading commit data...
pata_cypress.c Loading commit data...
pata_efar.c Loading commit data...
pata_hpt366.c Loading commit data...
pata_hpt37x.c Loading commit data...
pata_hpt3x2n.c Loading commit data...
pata_hpt3x3.c Loading commit data...
pata_icside.c Loading commit data...
pata_imx.c Loading commit data...
pata_isapnp.c Loading commit data...
pata_it8213.c Loading commit data...
pata_it821x.c Loading commit data...
pata_ixp4xx_cf.c Loading commit data...
pata_jmicron.c Loading commit data...
pata_legacy.c Loading commit data...
pata_macio.c Loading commit data...
pata_marvell.c Loading commit data...
pata_mpc52xx.c Loading commit data...
pata_mpiix.c Loading commit data...
pata_netcell.c Loading commit data...
pata_ninja32.c Loading commit data...
pata_ns87410.c Loading commit data...
pata_ns87415.c Loading commit data...
pata_octeon_cf.c Loading commit data...
pata_of_platform.c Loading commit data...
pata_oldpiix.c Loading commit data...
pata_opti.c Loading commit data...
pata_optidma.c Loading commit data...
pata_palmld.c Loading commit data...
pata_pcmcia.c Loading commit data...
pata_pdc2027x.c Loading commit data...
pata_pdc202xx_old.c Loading commit data...
pata_piccolo.c Loading commit data...
pata_platform.c Loading commit data...
pata_pxa.c Loading commit data...
pata_qdi.c Loading commit data...
pata_radisys.c Loading commit data...
pata_rb532_cf.c Loading commit data...
pata_rdc.c Loading commit data...
pata_rz1000.c Loading commit data...
pata_samsung_cf.c Loading commit data...
pata_sc1200.c Loading commit data...
pata_scc.c Loading commit data...
pata_sch.c Loading commit data...
pata_serverworks.c Loading commit data...
pata_sil680.c Loading commit data...
pata_sis.c Loading commit data...
pata_sl82c105.c Loading commit data...
pata_triflex.c Loading commit data...
pata_via.c Loading commit data...
pdc_adma.c Loading commit data...
sata_dwc_460ex.c Loading commit data...
sata_fsl.c Loading commit data...
sata_inic162x.c Loading commit data...
sata_mv.c Loading commit data...
sata_nv.c Loading commit data...
sata_promise.c Loading commit data...
sata_promise.h Loading commit data...
sata_qstor.c Loading commit data...
sata_sil.c Loading commit data...
sata_sil24.c Loading commit data...
sata_sis.c Loading commit data...
sata_svw.c Loading commit data...
sata_sx4.c Loading commit data...
sata_uli.c Loading commit data...
sata_via.c Loading commit data...
sata_vsc.c Loading commit data...
sis.h Loading commit data...