diff options
| author | H. Peter Anvin <hpa@linux.intel.com> | 2014-02-07 14:27:30 -0500 |
|---|---|---|
| committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-02-07 14:27:30 -0500 |
| commit | a3b072cd180c12e8fe0ece9487b9065808327640 (patch) | |
| tree | 62b982041be84748852d77cdf6ca5639ef40858f /lib/vsprintf.c | |
| parent | 75a1ba5b2c529db60ca49626bcaf0bddf4548438 (diff) | |
| parent | 081cd62a010f97b5bc1d2b0cd123c5abc692b68a (diff) | |
Merge tag 'efi-urgent' into x86/urgent
* Avoid WARN_ON() when mapping BGRT on Baytrail (EFI 32-bit).
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'lib/vsprintf.c')
| -rw-r--r-- | lib/vsprintf.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 10909c571494..185b6d300ebc 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -1155,6 +1155,30 @@ char *netdev_feature_string(char *buf, char *end, const u8 *addr, | |||
| 1155 | return number(buf, end, *(const netdev_features_t *)addr, spec); | 1155 | return number(buf, end, *(const netdev_features_t *)addr, spec); |
| 1156 | } | 1156 | } |
| 1157 | 1157 | ||
| 1158 | static noinline_for_stack | ||
| 1159 | char *address_val(char *buf, char *end, const void *addr, | ||
| 1160 | struct printf_spec spec, const char *fmt) | ||
| 1161 | { | ||
| 1162 | unsigned long long num; | ||
| 1163 | |||
| 1164 | spec.flags |= SPECIAL | SMALL | ZEROPAD; | ||
| 1165 | spec.base = 16; | ||
| 1166 | |||
| 1167 | switch (fmt[1]) { | ||
| 1168 | case 'd': | ||
| 1169 | num = *(const dma_addr_t *)addr; | ||
| 1170 | spec.field_width = sizeof(dma_addr_t) * 2 + 2; | ||
| 1171 | break; | ||
| 1172 | case 'p': | ||
| 1173 | default: | ||
| 1174 | num = *(const phys_addr_t *)addr; | ||
| 1175 | spec.field_width = sizeof(phys_addr_t) * 2 + 2; | ||
| 1176 | break; | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | return number(buf, end, num, spec); | ||
| 1180 | } | ||
| 1181 | |||
| 1158 | int kptr_restrict __read_mostly; | 1182 | int kptr_restrict __read_mostly; |
| 1159 | 1183 | ||
| 1160 | /* | 1184 | /* |
| @@ -1218,7 +1242,8 @@ int kptr_restrict __read_mostly; | |||
| 1218 | * N no separator | 1242 | * N no separator |
| 1219 | * The maximum supported length is 64 bytes of the input. Consider | 1243 | * The maximum supported length is 64 bytes of the input. Consider |
| 1220 | * to use print_hex_dump() for the larger input. | 1244 | * to use print_hex_dump() for the larger input. |
| 1221 | * - 'a' For a phys_addr_t type and its derivative types (passed by reference) | 1245 | * - 'a[pd]' For address types [p] phys_addr_t, [d] dma_addr_t and derivatives |
| 1246 | * (default assumed to be phys_addr_t, passed by reference) | ||
| 1222 | * - 'd[234]' For a dentry name (optionally 2-4 last components) | 1247 | * - 'd[234]' For a dentry name (optionally 2-4 last components) |
| 1223 | * - 'D[234]' Same as 'd' but for a struct file | 1248 | * - 'D[234]' Same as 'd' but for a struct file |
| 1224 | * | 1249 | * |
| @@ -1353,11 +1378,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 1353 | } | 1378 | } |
| 1354 | break; | 1379 | break; |
| 1355 | case 'a': | 1380 | case 'a': |
| 1356 | spec.flags |= SPECIAL | SMALL | ZEROPAD; | 1381 | return address_val(buf, end, ptr, spec, fmt); |
| 1357 | spec.field_width = sizeof(phys_addr_t) * 2 + 2; | ||
| 1358 | spec.base = 16; | ||
| 1359 | return number(buf, end, | ||
| 1360 | (unsigned long long) *((phys_addr_t *)ptr), spec); | ||
| 1361 | case 'd': | 1382 | case 'd': |
| 1362 | return dentry_name(buf, end, ptr, spec, fmt); | 1383 | return dentry_name(buf, end, ptr, spec, fmt); |
| 1363 | case 'D': | 1384 | case 'D': |
