Commit d8c03214 authored by Petr Mladek's avatar Petr Mladek
Browse files

Merge branch 'for-5.14-vsprintf-scanf' into for-linus

parents 80ae5529 d327ea15
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19395,6 +19395,7 @@ S: Maintained
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git
F:	Documentation/core-api/printk-formats.rst
F:	lib/test_printf.c
F:	lib/test_scanf.c
F:	lib/vsprintf.c
VT1211 HARDWARE MONITOR DRIVER
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ static inline u32 __seed(u32 x, u32 m)
 */
static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
{
	u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
	u32 i = ((seed >> 32) ^ (seed << 10) ^ seed) & 0xffffffffUL;

	state->s1 = __seed(i,   2U);
	state->s2 = __seed(i,   8U);
+3 −0
Original line number Diff line number Diff line
@@ -2163,6 +2163,9 @@ config TEST_KSTRTOX
config TEST_PRINTF
	tristate "Test printf() family of functions at runtime"

config TEST_SCANF
	tristate "Test scanf() family of functions at runtime"

config TEST_BITMAP
	tristate "Test bitmap_*() family of functions at runtime"
	help
+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o
obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o
obj-$(CONFIG_TEST_PRINTF) += test_printf.o
obj-$(CONFIG_TEST_SCANF) += test_scanf.o
obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
obj-$(CONFIG_TEST_STRSCPY) += test_strscpy.o
obj-$(CONFIG_TEST_UUID) += test_uuid.o
+10 −3
Original line number Diff line number Diff line
@@ -39,20 +39,22 @@ const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)

/*
 * Convert non-negative integer string representation in explicitly given radix
 * to an integer.
 * to an integer. A maximum of max_chars characters will be converted.
 *
 * Return number of characters consumed maybe or-ed with overflow bit.
 * If overflow occurs, result integer (incorrect) is still returned.
 *
 * Don't you dare use this function.
 */
unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p)
unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *p,
				  size_t max_chars)
{
	unsigned long long res;
	unsigned int rv;

	res = 0;
	rv = 0;
	while (1) {
	while (max_chars--) {
		unsigned int c = *s;
		unsigned int lc = c | 0x20; /* don't tolower() this line */
		unsigned int val;
@@ -82,6 +84,11 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long
	return rv;
}

unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p)
{
	return _parse_integer_limit(s, base, p, INT_MAX);
}

static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
{
	unsigned long long _res;
Loading