]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - lib/vsprintf.c
bcm2835-v4l2: Fix buffer overflow problem
[mirror_ubuntu-zesty-kernel.git] / lib / vsprintf.c
index 0967771d8f7fd725972c74097bd324a8b39b5609..f51765a7fc5b6355b1647ac43e19b020aad535ad 100644 (file)
@@ -1470,6 +1470,29 @@ char *flags_string(char *buf, char *end, void *flags_ptr, const char *fmt)
        return format_flags(buf, end, flags, names);
 }
 
+#ifdef CONFIG_KMSG_IDS
+
+unsigned long long __jhash_string(const char *str);
+
+static noinline_for_stack
+char *jhash_string(char *buf, char *end, const char *str, const char *fmt)
+{
+       struct printf_spec spec;
+       unsigned long long num;
+
+       num = __jhash_string(str);
+
+       spec.type = FORMAT_TYPE_PTR;
+       spec.field_width = 6;
+       spec.flags = SMALL | ZEROPAD;
+       spec.base = 16;
+       spec.precision = -1;
+
+       return number(buf, end, num, spec);
+}
+
+#endif
+
 int kptr_restrict __read_mostly;
 
 /*
@@ -1563,6 +1586,7 @@ int kptr_restrict __read_mostly;
  *       p page flags (see struct page) given as pointer to unsigned long
  *       g gfp flags (GFP_* and __GFP_*) given as pointer to gfp_t
  *       v vma flags (VM_*) given as pointer to unsigned long
+ * - 'j' Kernel message catalog jhash for System z
  *
  * ** Please update also Documentation/printk-formats.txt when making changes **
  *
@@ -1718,6 +1742,10 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 
        case 'G':
                return flags_string(buf, end, ptr, fmt);
+#ifdef CONFIG_KMSG_IDS
+       case 'j':
+               return jhash_string(buf, end, ptr, fmt);
+#endif
        }
        spec.flags |= SMALL;
        if (spec.field_width == -1) {