* [PATCH 4/6] gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_*
@ 2013-03-27 16:52 Hong Zhiguo
2013-03-28 14:37 ` Thomas Graf
2013-03-28 18:28 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Hong Zhiguo @ 2013-03-27 16:52 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev, davem, tgraf
Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
---
drivers/staging/gdm72xx/netlink_k.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c
index 52c25ba..c1239aa 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -15,7 +15,7 @@
#include <linux/module.h>
#include <linux/etherdevice.h>
-#include <linux/netlink.h>
+#include <net/netlink.h>
#include <asm/byteorder.h>
#include <net/sock.h>
@@ -25,12 +25,12 @@
#define ND_MAX_GROUP 30
#define ND_IFINDEX_LEN sizeof(int)
-#define ND_NLMSG_SPACE(len) (NLMSG_SPACE(len) + ND_IFINDEX_LEN)
+#define ND_NLMSG_SPACE(len) (nlmsg_total_size(len) + ND_IFINDEX_LEN)
#define ND_NLMSG_DATA(nlh) \
- ((void *)((char *)NLMSG_DATA(nlh) + ND_IFINDEX_LEN))
+ ((void *)((char *)nlmsg_data(nlh) + ND_IFINDEX_LEN))
#define ND_NLMSG_S_LEN(len) (len+ND_IFINDEX_LEN)
#define ND_NLMSG_R_LEN(nlh) (nlh->nlmsg_len-ND_IFINDEX_LEN)
-#define ND_NLMSG_IFIDX(nlh) NLMSG_DATA(nlh)
+#define ND_NLMSG_IFIDX(nlh) nlmsg_data(nlh)
#define ND_MAX_MSG_LEN 8096
#if defined(DEFINE_MUTEX)
@@ -51,7 +51,7 @@ static void netlink_rcv_cb(struct sk_buff *skb)
void *msg;
int ifindex;
- if (skb->len >= NLMSG_SPACE(0)) {
+ if (skb->len >= NLMSG_HDRLEN) {
nlh = (struct nlmsghdr *)skb->data;
if (skb->len < nlh->nlmsg_len ||
@@ -124,7 +124,7 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
return -EINVAL;
}
- skb = alloc_skb(NLMSG_SPACE(len), GFP_ATOMIC);
+ skb = nlmsg_new(len, GFP_ATOMIC);
if (!skb) {
pr_err("netlink_broadcast ret=%d\n", ret);
return -ENOMEM;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 4/6] gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_*
2013-03-27 16:52 [PATCH 4/6] gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_* Hong Zhiguo
@ 2013-03-28 14:37 ` Thomas Graf
2013-03-28 18:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Graf @ 2013-03-28 14:37 UTC (permalink / raw)
To: Hong Zhiguo; +Cc: linux-kernel, netdev, davem
On 03/28/13 at 12:52am, Hong Zhiguo wrote:
> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
> ---
> drivers/staging/gdm72xx/netlink_k.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c
> index 52c25ba..c1239aa 100644
> --- a/drivers/staging/gdm72xx/netlink_k.c
> +++ b/drivers/staging/gdm72xx/netlink_k.c
> @@ -25,12 +25,12 @@
>
> #define ND_MAX_GROUP 30
> #define ND_IFINDEX_LEN sizeof(int)
> -#define ND_NLMSG_SPACE(len) (NLMSG_SPACE(len) + ND_IFINDEX_LEN)
> +#define ND_NLMSG_SPACE(len) (nlmsg_total_size(len) + ND_IFINDEX_LEN)
> #define ND_NLMSG_DATA(nlh) \
> - ((void *)((char *)NLMSG_DATA(nlh) + ND_IFINDEX_LEN))
> + ((void *)((char *)nlmsg_data(nlh) + ND_IFINDEX_LEN))
> #define ND_NLMSG_S_LEN(len) (len+ND_IFINDEX_LEN)
> #define ND_NLMSG_R_LEN(nlh) (nlh->nlmsg_len-ND_IFINDEX_LEN)
> -#define ND_NLMSG_IFIDX(nlh) NLMSG_DATA(nlh)
> +#define ND_NLMSG_IFIDX(nlh) nlmsg_data(nlh)
> #define ND_MAX_MSG_LEN 8096
This is not pretty at all but outside of the context of your patch.
Acked-by: Thomas Graf <tgraf@suug.ch>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/6] gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_*
2013-03-27 16:52 [PATCH 4/6] gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_* Hong Zhiguo
2013-03-28 14:37 ` Thomas Graf
@ 2013-03-28 18:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-03-28 18:28 UTC (permalink / raw)
To: honkiko; +Cc: linux-kernel, netdev, tgraf
From: Hong Zhiguo <honkiko@gmail.com>
Date: Thu, 28 Mar 2013 00:52:17 +0800
> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-28 18:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 16:52 [PATCH 4/6] gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_* Hong Zhiguo
2013-03-28 14:37 ` Thomas Graf
2013-03-28 18:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).