aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-27 00:45:21 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-27 00:54:14 -0400
commitc64e66c67b574f25a048886807c2007d17d50d0a (patch)
treedb193766a1246bcff49de9f8b8b2a286979e3299 /kernel/audit.c
parente05273341c573f7b543f45c06e4a232c5b7c5a59 (diff)
audit: netlink: Move away from NLMSG_NEW().
And use nlmsg_data() while we're here too. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 1c7f2c61416b..30b252a1fb61 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -384,7 +384,7 @@ static void audit_hold_skb(struct sk_buff *skb)
384static void audit_printk_skb(struct sk_buff *skb) 384static void audit_printk_skb(struct sk_buff *skb)
385{ 385{
386 struct nlmsghdr *nlh = nlmsg_hdr(skb); 386 struct nlmsghdr *nlh = nlmsg_hdr(skb);
387 char *data = NLMSG_DATA(nlh); 387 char *data = nlmsg_data(nlh);
388 388
389 if (nlh->nlmsg_type != AUDIT_EOE) { 389 if (nlh->nlmsg_type != AUDIT_EOE) {
390 if (printk_ratelimit()) 390 if (printk_ratelimit())
@@ -516,14 +516,15 @@ struct sk_buff *audit_make_reply(int pid, int seq, int type, int done,
516 if (!skb) 516 if (!skb)
517 return NULL; 517 return NULL;
518 518
519 nlh = NLMSG_NEW(skb, pid, seq, t, size, flags); 519 nlh = nlmsg_put(skb, pid, seq, t, size, flags);
520 data = NLMSG_DATA(nlh); 520 if (!nlh)
521 goto out_kfree_skb;
522 data = nlmsg_data(nlh);
521 memcpy(data, payload, size); 523 memcpy(data, payload, size);
522 return skb; 524 return skb;
523 525
524nlmsg_failure: /* Used by NLMSG_NEW */ 526out_kfree_skb:
525 if (skb) 527 kfree_skb(skb);
526 kfree_skb(skb);
527 return NULL; 528 return NULL;
528} 529}
529 530
@@ -680,7 +681,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
680 sessionid = audit_get_sessionid(current); 681 sessionid = audit_get_sessionid(current);
681 security_task_getsecid(current, &sid); 682 security_task_getsecid(current, &sid);
682 seq = nlh->nlmsg_seq; 683 seq = nlh->nlmsg_seq;
683 data = NLMSG_DATA(nlh); 684 data = nlmsg_data(nlh);
684 685
685 switch (msg_type) { 686 switch (msg_type) {
686 case AUDIT_GET: 687 case AUDIT_GET:
@@ -1060,13 +1061,15 @@ static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx,
1060 1061
1061 ab->skb = nlmsg_new(AUDIT_BUFSIZ, gfp_mask); 1062 ab->skb = nlmsg_new(AUDIT_BUFSIZ, gfp_mask);
1062 if (!ab->skb) 1063 if (!ab->skb)
1063 goto nlmsg_failure; 1064 goto err;
1064 1065
1065 nlh = NLMSG_NEW(ab->skb, 0, 0, type, 0, 0); 1066 nlh = nlmsg_put(ab->skb, 0, 0, type, 0, 0);
1067 if (!nlh)
1068 goto out_kfree_skb;
1066 1069
1067 return ab; 1070 return ab;
1068 1071
1069nlmsg_failure: /* Used by NLMSG_NEW */ 1072out_kfree_skb:
1070 kfree_skb(ab->skb); 1073 kfree_skb(ab->skb);
1071 ab->skb = NULL; 1074 ab->skb = NULL;
1072err: 1075err: