Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

overflow: Replace fake root_device with kunit_device

Using struct root_device to create fake devices for tests is something
of a hack. The new struct kunit_device is meant for this purpose, so use
it instead.

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

davidgow@google.com and committed by
Shuah Khan
83701838 46ee8f68

+2 -3
+2 -3
lib/overflow_kunit.c
··· 6 6 */ 7 7 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8 8 9 + #include <kunit/device.h> 9 10 #include <kunit/test.h> 10 11 #include <linux/device.h> 11 12 #include <linux/kernel.h> ··· 619 618 } while (0) 620 619 621 620 /* Create dummy device for devm_kmalloc()-family tests. */ 622 - dev = root_device_register(device_name); 621 + dev = kunit_device_register(test, device_name); 623 622 KUNIT_ASSERT_FALSE_MSG(test, IS_ERR(dev), 624 623 "Cannot register test device\n"); 625 624 ··· 634 633 check_allocation_overflow(kvzalloc_node); 635 634 check_allocation_overflow(devm_kmalloc); 636 635 check_allocation_overflow(devm_kzalloc); 637 - 638 - device_unregister(dev); 639 636 640 637 kunit_info(test, "%d allocation overflow tests finished\n", count); 641 638 #undef check_allocation_overflow