summaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-07 22:25:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-07 22:25:37 -0500
commitb5dd0c658c31b469ccff1b637e5124851e7a4a1c (patch)
treedc0b31a5aa62bb4e1fa653a4f176c2faae51f9e0 /lib/vsprintf.c
parent610cd4eadec4f97acd25d3108b0e50d1362b3319 (diff)
parentfe0436e10c8845aed24cad3a1c719efcd6e583eb (diff)
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - some of the rest of MM - various misc things - dynamic-debug updates - checkpatch - some epoll speedups - autofs - rapidio - lib/, lib/lzo/ updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (83 commits) samples/mic/mpssd/mpssd.h: remove duplicate header kernel/fork.c: remove duplicated include include/linux/relay.h: fix percpu annotation in struct rchan arch/nios2/mm/fault.c: remove duplicate include unicore32: stop printing the virtual memory layout MAINTAINERS: fix GTA02 entry and mark as orphan mm: create the new vm_fault_t type arm, s390, unicore32: remove oneliner wrappers for memblock_alloc() arch: simplify several early memory allocations openrisc: simplify pte_alloc_one_kernel() sh: prefer memblock APIs returning virtual address microblaze: prefer memblock API returning virtual address powerpc: prefer memblock APIs returning virtual address lib/lzo: separate lzo-rle from lzo lib/lzo: implement run-length encoding lib/lzo: fast 8-byte copy on arm64 lib/lzo: 64-bit CTZ on arm64 lib/lzo: tidy-up ifdefs ipc/sem.c: replace kvmalloc/memset with kvzalloc and use struct_size ipc: annotate implicit fall through ...
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 3add92329bae..30b00de4f321 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <stdarg.h> 19#include <stdarg.h>
20#include <linux/build_bug.h>
20#include <linux/clk.h> 21#include <linux/clk.h>
21#include <linux/clk-provider.h> 22#include <linux/clk-provider.h>
22#include <linux/module.h> /* for KSYM_SYMBOL_LEN */ 23#include <linux/module.h> /* for KSYM_SYMBOL_LEN */
@@ -405,6 +406,8 @@ struct printf_spec {
405 unsigned int base:8; /* number base, 8, 10 or 16 only */ 406 unsigned int base:8; /* number base, 8, 10 or 16 only */
406 signed int precision:16; /* # of digits/chars */ 407 signed int precision:16; /* # of digits/chars */
407} __packed; 408} __packed;
409static_assert(sizeof(struct printf_spec) == 8);
410
408#define FIELD_WIDTH_MAX ((1 << 23) - 1) 411#define FIELD_WIDTH_MAX ((1 << 23) - 1)
409#define PRECISION_MAX ((1 << 15) - 1) 412#define PRECISION_MAX ((1 << 15) - 1)
410 413
@@ -422,8 +425,6 @@ char *number(char *buf, char *end, unsigned long long num,
422 int field_width = spec.field_width; 425 int field_width = spec.field_width;
423 int precision = spec.precision; 426 int precision = spec.precision;
424 427
425 BUILD_BUG_ON(sizeof(struct printf_spec) != 8);
426
427 /* locase = 0 or 0x20. ORing digits or letters with 'locase' 428 /* locase = 0 or 0x20. ORing digits or letters with 'locase'
428 * produces same digits or (maybe lowercased) letters */ 429 * produces same digits or (maybe lowercased) letters */
429 locase = (spec.flags & SMALL); 430 locase = (spec.flags & SMALL);