Skip to content

Commit 9631d79

Browse files
honkikodavem330
authored andcommitted
connector: replace obsolete NLMSG_* with type safe nlmsg_*
Signed-off-by: Hong Zhiguo <honkiko@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e07ebea commit 9631d79

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎drivers/connector/connector.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <linux/module.h>
2424
#include <linux/list.h>
2525
#include <linux/skbuff.h>
26-
#include <linux/netlink.h>
26+
#include <net/netlink.h>
2727
#include <linux/moduleparam.h>
2828
#include <linux/connector.h>
2929
#include <linux/slab.h>
@@ -95,13 +95,13 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
9595
if (!netlink_has_listeners(dev->nls, group))
9696
return -ESRCH;
9797

98-
size = NLMSG_SPACE(sizeof(*msg) + msg->len);
98+
size = sizeof(*msg) + msg->len;
9999

100-
skb = alloc_skb(size, gfp_mask);
100+
skb = nlmsg_new(size, gfp_mask);
101101
if (!skb)
102102
return -ENOMEM;
103103

104-
nlh = nlmsg_put(skb, 0, msg->seq, NLMSG_DONE, size - sizeof(*nlh), 0);
104+
nlh = nlmsg_put(skb, 0, msg->seq, NLMSG_DONE, size, 0);
105105
if (!nlh) {
106106
kfree_skb(skb);
107107
return -EMSGSIZE;
@@ -124,7 +124,7 @@ static int cn_call_callback(struct sk_buff *skb)
124124
{
125125
struct cn_callback_entry *i, *cbq = NULL;
126126
struct cn_dev *dev = &cdev;
127-
struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
127+
struct cn_msg *msg = nlmsg_data(nlmsg_hdr(skb));
128128
struct netlink_skb_parms *nsp = &NETLINK_CB(skb);
129129
int err = -ENODEV;
130130

@@ -162,7 +162,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
162162

163163
skb = skb_get(__skb);
164164

165-
if (skb->len >= NLMSG_SPACE(0)) {
165+
if (skb->len >= NLMSG_HDRLEN) {
166166
nlh = nlmsg_hdr(skb);
167167

168168
if (nlh->nlmsg_len < sizeof(struct cn_msg) ||

0 commit comments

Comments
 (0)