diff options
| author | Jia He <[email protected]> | 2019-08-09 01:24:57 +0000 |
|---|---|---|
| committer | Petr Mladek <[email protected]> | 2019-08-15 14:58:06 +0000 |
| commit | cf6b7921fc19e537cd5ae88460195c8599eb5d9d (patch) | |
| tree | aeffd961e6d85f8128c57d1b619f086b9ff9a8d2 /lib/test_printf.c | |
| parent | vsprintf: Prevent crash when dereferencing invalid pointers for %pD (diff) | |
| download | kernel-cf6b7921fc19e537cd5ae88460195c8599eb5d9d.tar.gz kernel-cf6b7921fc19e537cd5ae88460195c8599eb5d9d.zip | |
lib/test_printf: Add test of null/invalid pointer dereference for dentry
This add some additional test cases of null/invalid pointer dereference
for dentry and file (%pd and %pD)
Link: http://lkml.kernel.org/r/[email protected]
To: Geert Uytterhoeven <[email protected]>
To: Sergey Senozhatsky <[email protected]>
To: Thomas Gleixner <[email protected]>
To: Andy Shevchenko <[email protected]>
To: Petr Mladek <[email protected]>
To: [email protected]
Cc: Kees Cook <[email protected]>
Cc: "Steven Rostedt (VMware)" <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: "Tobin C. Harding" <[email protected]>
Signed-off-by: Jia He <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Reviewed-by: Sergey Senozhatsky <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Diffstat (limited to 'lib/test_printf.c')
| -rw-r--r-- | lib/test_printf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c index 944eb50f3862..befedffeb476 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -455,6 +455,13 @@ dentry(void) test("foo", "%pd", &test_dentry[0]); test("foo", "%pd2", &test_dentry[0]); + /* test the null/invalid pointer case for dentry */ + test("(null)", "%pd", NULL); + test("(efault)", "%pd", PTR_INVALID); + /* test the null/invalid pointer case for file */ + test("(null)", "%pD", NULL); + test("(efault)", "%pD", PTR_INVALID); + test("romeo", "%pd", &test_dentry[3]); test("alfa/romeo", "%pd2", &test_dentry[3]); test("bravo/alfa/romeo", "%pd3", &test_dentry[3]); |
