include/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument
authorJulia Lawall <julia@diku.dk>
Fri, 28 Jan 2011 05:43:40 +0000 (05:43 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Feb 2011 04:47:08 +0000 (20:47 -0800)
nlmsg_cancel can accept NULL as its second argument, so for similarity,
this patch extends genlmsg_cancel to be able to accept a NULL second
argument as well.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/genetlink.h

index 8a64b811a39aba9278a258396f268aa35a422e22..b4c7c1cbcf400298d001da37162b2ca7c3b78d0a 100644 (file)
@@ -195,7 +195,8 @@ static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
  */
 static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
 {
-       nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
+       if (hdr)
+               nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
 }
 
 /**