mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
Printk changes for 5.2
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEESH4wyp42V4tXvYsjUqAMR0iAlPIFAlzP8nQACgkQUqAMR0iA lPK79A/+NkRouqA9ihAZhUbgW0DHzOAFvUJSBgX11HQAZbGjngakuoyYFvwUx0T0 m80SUTCysxQrWl+xLdccPZ9ZrhP2KFQrEBEdeYHZ6ymcYcl83+3bOIBS7VwdZAbO EzB8u/58uU/sI6ABL4lF7ZF/+R+U4CXveEUoVUF04bxdPOxZkRX4PT8u3DzCc+RK r4yhwQUXGcKrHa2GrRL3GXKsDxcnRdFef/nzq4RFSZsi0bpskzEj34WrvctV6j+k FH/R3kEcZrtKIMPOCoDMMWq07yNqK/QKj0MJlGoAlwfK4INgcrSXLOx+pAmr6BNq uMKpkxCFhnkZVKgA/GbKEGzFf+ZGz9+2trSFka9LD2Ig6DIstwXqpAgiUK8JFQYj lq1mTaJZD3DfF2vnGHGeAfBFG3XETv+mIT/ow6BcZi3NyNSVIaqa5GAR+lMc6xkR waNkcMDkzLFuP1r0p7ZizXOksk9dFkMP3M6KqJomRtApwbSNmtt+O2jvyLPvB3+w wRyN9WT7IJZYo4v0rrD5Bl6BjV15ZeCPRSFZRYofX+vhcqJQsFX1M9DeoNqokh55 Cri8f6MxGzBVjE1G70y2/cAFFvKEKJud0NUIMEuIbcy+xNrEAWPF8JhiwpKKnU10 c0u674iqHJ2HeVsYWZF0zqzqQ6E1Idhg/PrXfuVuhAaL5jIOnYY= =WZfC -----END PGP SIGNATURE----- Merge tag 'printk-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk Pull printk updates from Petr Mladek: - Allow state reset of printk_once() calls. - Prevent crashes when dereferencing invalid pointers in vsprintf(). Only the first byte is checked for simplicity. - Make vsprintf warnings consistent and inlined. - Treewide conversion of obsolete %pf, %pF to %ps, %pF printf modifiers. - Some clean up of vsprintf and test_printf code. * tag 'printk-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: lib/vsprintf: Make function pointer_string static vsprintf: Limit the length of inlined error messages vsprintf: Avoid confusion between invalid address and value vsprintf: Prevent crash when dereferencing invalid pointers vsprintf: Consolidate handling of unknown pointer specifiers vsprintf: Factor out %pO handler as kobject_string() vsprintf: Factor out %pV handler as va_format() vsprintf: Factor out %p[iI] handler as ip_addr_string() vsprintf: Do not check address of well-known strings vsprintf: Consistent %pK handling for kptr_restrict == 0 vsprintf: Shuffle restricted_pointer() printk: Tie printk_once / printk_deferred_once into .data.once for reset treewide: Switch printk users from %pf and %pF to %ps and %pS, respectively lib/test_printf: Switch to bitmap_zalloc()
This commit is contained in:
commit
0968621917
60 changed files with 410 additions and 272 deletions
|
@ -241,6 +241,7 @@ plain_format(void)
|
|||
#define PTR ((void *)0x456789ab)
|
||||
#define PTR_STR "456789ab"
|
||||
#define PTR_VAL_NO_CRNG "(ptrval)"
|
||||
#define ZEROS ""
|
||||
|
||||
static int __init
|
||||
plain_format(void)
|
||||
|
@ -270,7 +271,6 @@ plain_hash_to_buffer(const void *p, char *buf, size_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
plain_hash(void)
|
||||
{
|
||||
|
@ -327,6 +327,24 @@ test_hashed(const char *fmt, const void *p)
|
|||
test(buf, fmt, p);
|
||||
}
|
||||
|
||||
static void __init
|
||||
null_pointer(void)
|
||||
{
|
||||
test_hashed("%p", NULL);
|
||||
test(ZEROS "00000000", "%px", NULL);
|
||||
test("(null)", "%pE", NULL);
|
||||
}
|
||||
|
||||
#define PTR_INVALID ((void *)0x000000ab)
|
||||
|
||||
static void __init
|
||||
invalid_pointer(void)
|
||||
{
|
||||
test_hashed("%p", PTR_INVALID);
|
||||
test(ZEROS "000000ab", "%px", PTR_INVALID);
|
||||
test("(efault)", "%pE", PTR_INVALID);
|
||||
}
|
||||
|
||||
static void __init
|
||||
symbol_ptr(void)
|
||||
{
|
||||
|
@ -464,8 +482,7 @@ struct_rtc_time(void)
|
|||
.tm_year = 118,
|
||||
};
|
||||
|
||||
test_hashed("%pt", &tm);
|
||||
|
||||
test("(%ptR?)", "%pt", &tm);
|
||||
test("2018-11-26T05:35:43", "%ptR", &tm);
|
||||
test("0118-10-26T05:35:43", "%ptRr", &tm);
|
||||
test("05:35:43|2018-11-26", "%ptRt|%ptRd", &tm, &tm);
|
||||
|
@ -483,14 +500,14 @@ static void __init
|
|||
large_bitmap(void)
|
||||
{
|
||||
const int nbits = 1 << 16;
|
||||
unsigned long *bits = kcalloc(BITS_TO_LONGS(nbits), sizeof(long), GFP_KERNEL);
|
||||
unsigned long *bits = bitmap_zalloc(nbits, GFP_KERNEL);
|
||||
if (!bits)
|
||||
return;
|
||||
|
||||
bitmap_set(bits, 1, 20);
|
||||
bitmap_set(bits, 60000, 15);
|
||||
test("1-20,60000-60014", "%*pbl", nbits, bits);
|
||||
kfree(bits);
|
||||
bitmap_free(bits);
|
||||
}
|
||||
|
||||
static void __init
|
||||
|
@ -574,6 +591,8 @@ static void __init
|
|||
test_pointer(void)
|
||||
{
|
||||
plain();
|
||||
null_pointer();
|
||||
invalid_pointer();
|
||||
symbol_ptr();
|
||||
kernel_ptr();
|
||||
struct_resource();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue