summaryrefslogtreecommitdiffstats
path: root/drivers/connector/connector.c
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>2012-06-26 07:41:24 +0200
committerDavid S. Miller <davem@davemloft.net>2012-06-27 06:14:20 +0200
commit85c931665d822f1bedd69ecaab09a8ba84643020 (patch)
treedfa309a0e71fb29912465a239d5fef386ab18391 /drivers/connector/connector.c
parentteam: remove unused rcu_head field from team_port struct (diff)
downloadlinux-85c931665d822f1bedd69ecaab09a8ba84643020.tar.xz
linux-85c931665d822f1bedd69ecaab09a8ba84643020.zip
connector: use nlmsg_put() instead of NLMSG_PUT() macro.
The NLMSG_PUT() macro contains a hidden goto which makes the code hard to audit and very error prone. While been there also use the inline function nlmsg_data() instead of the NLMSG_DATA() macro to do explicit type checking. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/connector/connector.c')
-rw-r--r--drivers/connector/connector.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index dde6a0fad408..34e0e9e4d913 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -101,19 +101,19 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
if (!skb)
return -ENOMEM;
- nlh = NLMSG_PUT(skb, 0, msg->seq, NLMSG_DONE, size - sizeof(*nlh));
+ nlh = nlmsg_put(skb, 0, msg->seq, NLMSG_DONE, size - sizeof(*nlh), 0);
+ if (!nlh) {
+ kfree_skb(skb);
+ return -EMSGSIZE;
+ }
- data = NLMSG_DATA(nlh);
+ data = nlmsg_data(nlh);
memcpy(data, msg, sizeof(*data) + msg->len);
NETLINK_CB(skb).dst_group = group;
return netlink_broadcast(dev->nls, skb, 0, group, gfp_mask);
-
-nlmsg_failure:
- kfree_skb(skb);
- return -EINVAL;
}
EXPORT_SYMBOL_GPL(cn_netlink_send);