Revert "KVM: x86: expose MSR_TSC_AUX to userspace"
[pandora-kernel.git] / lib / nlattr.c
index a8408b6..be25e35 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/string.h>
+#include <linux/ratelimit.h>
+#include <linux/sched.h>
 #include <linux/types.h>
 #include <net/netlink.h>
 
@@ -197,8 +199,8 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
        }
 
        if (unlikely(rem > 0))
-               printk(KERN_WARNING "netlink: %d bytes leftover after parsing "
-                      "attributes.\n", rem);
+               pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
+                                   rem, current->comm);
 
        err = 0;
 errout:
@@ -299,9 +301,15 @@ int nla_memcmp(const struct nlattr *nla, const void *data,
  */
 int nla_strcmp(const struct nlattr *nla, const char *str)
 {
-       int len = strlen(str) + 1;
-       int d = nla_len(nla) - len;
+       int len = strlen(str);
+       char *buf = nla_data(nla);
+       int attrlen = nla_len(nla);
+       int d;
 
+       if (attrlen > 0 && buf[attrlen - 1] == '\0')
+               attrlen--;
+
+       d = attrlen - len;
        if (d == 0)
                d = memcmp(nla_data(nla), str, len);