diff options
Diffstat (limited to 'lib/vsprintf.c')
| -rw-r--r-- | lib/vsprintf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 993599e66e5a..8e75003d62f6 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -777,6 +777,18 @@ char *uuid_string(char *buf, char *end, const u8 *addr, | |||
| 777 | return string(buf, end, uuid, spec); | 777 | return string(buf, end, uuid, spec); |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | static | ||
| 781 | char *netdev_feature_string(char *buf, char *end, const u8 *addr, | ||
| 782 | struct printf_spec spec) | ||
| 783 | { | ||
| 784 | spec.flags |= SPECIAL | SMALL | ZEROPAD; | ||
| 785 | if (spec.field_width == -1) | ||
| 786 | spec.field_width = 2 + 2 * sizeof(netdev_features_t); | ||
| 787 | spec.base = 16; | ||
| 788 | |||
| 789 | return number(buf, end, *(const netdev_features_t *)addr, spec); | ||
| 790 | } | ||
| 791 | |||
| 780 | int kptr_restrict __read_mostly; | 792 | int kptr_restrict __read_mostly; |
| 781 | 793 | ||
| 782 | /* | 794 | /* |
| @@ -824,6 +836,7 @@ int kptr_restrict __read_mostly; | |||
| 824 | * Do not use this feature without some mechanism to verify the | 836 | * Do not use this feature without some mechanism to verify the |
| 825 | * correctness of the format string and va_list arguments. | 837 | * correctness of the format string and va_list arguments. |
| 826 | * - 'K' For a kernel pointer that should be hidden from unprivileged users | 838 | * - 'K' For a kernel pointer that should be hidden from unprivileged users |
| 839 | * - 'NF' For a netdev_features_t | ||
| 827 | * | 840 | * |
| 828 | * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 | 841 | * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 |
| 829 | * function pointers are really function descriptors, which contain a | 842 | * function pointers are really function descriptors, which contain a |
| @@ -896,6 +909,12 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 896 | has_capability_noaudit(current, CAP_SYSLOG)))) | 909 | has_capability_noaudit(current, CAP_SYSLOG)))) |
| 897 | ptr = NULL; | 910 | ptr = NULL; |
| 898 | break; | 911 | break; |
| 912 | case 'N': | ||
| 913 | switch (fmt[1]) { | ||
| 914 | case 'F': | ||
| 915 | return netdev_feature_string(buf, end, ptr, spec); | ||
| 916 | } | ||
| 917 | break; | ||
| 899 | } | 918 | } |
| 900 | spec.flags |= SMALL; | 919 | spec.flags |= SMALL; |
| 901 | if (spec.field_width == -1) { | 920 | if (spec.field_width == -1) { |
