Category: Coccinelle

V4L/DVB (12477): Use dst_type field instead of type_flags

Author: Julia Lawall <julia@diku.dk> It seems from other code that it is the dst_type field rather than the type_flags field that contains values of the form DST_TYPE_IS… The type_flags field contains values of the form DST_TYPE_HAS… The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct dst_state E; @@ ( *E.type_flags …

Continue reading

specialix.c: convert nested spin_lock_irqsave to spin_lock

Author: Julia Lawall <julia@diku.dk> If spin_lock_irqsave is called twice in a row with the same second argument, the interrupt state at the point of the second call overwrites the value saved by the first call. Indeed, the second call does not need to save the interrupt state, so it is changed to a simple spin_lock. …

Continue reading

USB: storage: Drop an unneeded a NULL test

Author: Julia Lawall <julia@diku.dk> In each case, the NULL test is not necessary because the function is static and at the only places where it is called, the us argument has already been dereferenced. The semantic patch that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; expression E,E1; identifier i,fld; statement S; …

Continue reading

HID: Move dereferences below a NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test is necessary, then the dereferences should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; expression E,E1; identifier i,fld; statement S; @@ – T i = E->fld; + T i; … when != E=E1 when …

Continue reading

drivers/net: Move a dereference below a NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test is necessary, then the dereferences should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; expression E,E1; identifier i,fld; statement S; @@ – T i = E->fld; + T i; … when != E=E1 when …

Continue reading

drivers/net/mlx4: Adjust constant

Author: Julia Lawall <julia@diku.dk> The values in the advertising field are typically ADVERTISED_xxx, not SUPPORTED_xxx. Both SUPPORTED_10000baseT_Full and ADVERTISED_1000baseT_Full have the same value. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct ethtool_cmd E; @@ *E.advertising = SUPPORTED_10000baseT_Full // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller — drivers/net/mlx4/en_ethtool.c | 2 …

Continue reading

drivers/net: Move a dereference below a NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test is necessary, then the dereference should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; expression E,E1; identifier i,fld; statement S; @@ – T i = E->fld; + T i; … when != E=E1 when …

Continue reading

ALSA: sound/isa: convert nested spin_lock_irqsave to spin_lock

Author: Julia Lawall <julia@diku.dk> If spin_lock_irqsave is called twice in a row with the same second argument, the interrupt state at the point of the second call overwrites the value saved by the first call. Indeed, the second call does not need to save the interrupt state, so it is changed to a simple spin_lock. …

Continue reading

Staging: meilhaus: convert nested spin_lock_irqsave to spin_lock

Author: Julia Lawall <julia@diku.dk> If spin_lock_irqsave is called twice in a row with the same second argument, the interrupt state at the point of the second call overwrites the value saved by the first call. Indeed, the second call does not need to save the interrupt state, so it is changed to a simple spin_lock. …

Continue reading

arch/blackfin: Add kmalloc NULL tests

Author: Julia Lawall <julia@diku.dk> Check that the result of kmalloc is not NULL before passing it to other functions. In the first two cases, the new code returns -ENOMEM, which seems compatible with what is done for similar functions for other architectures. In the last two cases, the new code fails silently, ie just returns, …

Continue reading