diff options
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 76c9a11b72d6..4e9d20829681 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -151,7 +151,7 @@ struct audit_buffer { | |||
151 | 151 | ||
152 | static void audit_set_pid(struct audit_buffer *ab, pid_t pid) | 152 | static void audit_set_pid(struct audit_buffer *ab, pid_t pid) |
153 | { | 153 | { |
154 | struct nlmsghdr *nlh = (struct nlmsghdr *)ab->skb->data; | 154 | struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); |
155 | nlh->nlmsg_pid = pid; | 155 | nlh->nlmsg_pid = pid; |
156 | } | 156 | } |
157 | 157 | ||
@@ -750,7 +750,7 @@ static void audit_receive_skb(struct sk_buff *skb) | |||
750 | u32 rlen; | 750 | u32 rlen; |
751 | 751 | ||
752 | while (skb->len >= NLMSG_SPACE(0)) { | 752 | while (skb->len >= NLMSG_SPACE(0)) { |
753 | nlh = (struct nlmsghdr *)skb->data; | 753 | nlh = nlmsg_hdr(skb); |
754 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 754 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) |
755 | return; | 755 | return; |
756 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | 756 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); |
@@ -795,7 +795,7 @@ static int __init audit_init(void) | |||
795 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", | 795 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", |
796 | audit_default ? "enabled" : "disabled"); | 796 | audit_default ? "enabled" : "disabled"); |
797 | audit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive, | 797 | audit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive, |
798 | THIS_MODULE); | 798 | NULL, THIS_MODULE); |
799 | if (!audit_sock) | 799 | if (!audit_sock) |
800 | audit_panic("cannot initialize netlink socket"); | 800 | audit_panic("cannot initialize netlink socket"); |
801 | else | 801 | else |
@@ -1073,7 +1073,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | |||
1073 | goto out; | 1073 | goto out; |
1074 | } | 1074 | } |
1075 | va_copy(args2, args); | 1075 | va_copy(args2, args); |
1076 | len = vsnprintf(skb->tail, avail, fmt, args); | 1076 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args); |
1077 | if (len >= avail) { | 1077 | if (len >= avail) { |
1078 | /* The printk buffer is 1024 bytes long, so if we get | 1078 | /* The printk buffer is 1024 bytes long, so if we get |
1079 | * here and AUDIT_BUFSIZ is at least 1024, then we can | 1079 | * here and AUDIT_BUFSIZ is at least 1024, then we can |
@@ -1082,7 +1082,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | |||
1082 | max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); | 1082 | max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); |
1083 | if (!avail) | 1083 | if (!avail) |
1084 | goto out; | 1084 | goto out; |
1085 | len = vsnprintf(skb->tail, avail, fmt, args2); | 1085 | len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2); |
1086 | } | 1086 | } |
1087 | if (len > 0) | 1087 | if (len > 0) |
1088 | skb_put(skb, len); | 1088 | skb_put(skb, len); |
@@ -1143,7 +1143,7 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf, | |||
1143 | return; | 1143 | return; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | ptr = skb->tail; | 1146 | ptr = skb_tail_pointer(skb); |
1147 | for (i=0; i<len; i++) { | 1147 | for (i=0; i<len; i++) { |
1148 | *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ | 1148 | *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ |
1149 | *ptr++ = hex[buf[i] & 0x0F]; /* Lower nibble */ | 1149 | *ptr++ = hex[buf[i] & 0x0F]; /* Lower nibble */ |
@@ -1175,7 +1175,7 @@ static void audit_log_n_string(struct audit_buffer *ab, size_t slen, | |||
1175 | if (!avail) | 1175 | if (!avail) |
1176 | return; | 1176 | return; |
1177 | } | 1177 | } |
1178 | ptr = skb->tail; | 1178 | ptr = skb_tail_pointer(skb); |
1179 | *ptr++ = '"'; | 1179 | *ptr++ = '"'; |
1180 | memcpy(ptr, string, slen); | 1180 | memcpy(ptr, string, slen); |
1181 | ptr += slen; | 1181 | ptr += slen; |
@@ -1268,7 +1268,7 @@ void audit_log_end(struct audit_buffer *ab) | |||
1268 | audit_log_lost("rate limit exceeded"); | 1268 | audit_log_lost("rate limit exceeded"); |
1269 | } else { | 1269 | } else { |
1270 | if (audit_pid) { | 1270 | if (audit_pid) { |
1271 | struct nlmsghdr *nlh = (struct nlmsghdr *)ab->skb->data; | 1271 | struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); |
1272 | nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); | 1272 | nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); |
1273 | skb_queue_tail(&audit_skb_queue, ab->skb); | 1273 | skb_queue_tail(&audit_skb_queue, ab->skb); |
1274 | ab->skb = NULL; | 1274 | ab->skb = NULL; |