• Julia Lawall's avatar
    net/wireless/nl80211.c: Avoid call to genlmsg_cancel · efe1cf0c
    Julia Lawall authored
    genlmsg_cancel subtracts some constants from its second argument before
    calling nlmsg_cancel.  nlmsg_cancel then calls nlmsg_trim on the same
    arguments.  nlmsg_trim tests for NULL before doing any computation, but a
    NULL second argument to genlmsg_cancel is no longer NULL due to the initial
    subtraction.  Nothing else happens in this execution, so the call to
    genlmsg_cancel is simply unnecessary in this case.
    
    The semantic match that finds this problem is as follows:
    (http://coccinelle.lip6.fr/)
    
    // <smpl>
    @@
    expression data;
    @@
    
    if (data == NULL) { ...
    * genlmsg_cancel(..., data);
      ...
      return ...;
    }
    // </smpl>
    Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    efe1cf0c
nl80211.c 157 KB