test_overflow: fix an IS_ERR() vs NULL bug
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 12 Jun 2018 12:04:33 +0000 (15:04 +0300)
committerKees Cook <keescook@chromium.org>
Tue, 12 Jun 2018 23:19:22 +0000 (16:19 -0700)
root_device_register() returns error pointers, it never returns NULL.

Fixes: ca90800a91ba ("test_overflow: Add memory allocation overflow tests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
lib/test_overflow.c

index aecbbb2173052229c9b28bbb5852a0e691c4b46b..2278fe05a1b0a033f3120a7a1927b982c103f5bb 100644 (file)
@@ -367,7 +367,7 @@ static int __init test_overflow_allocation(void)
 
        /* Create dummy device for devm_kmalloc()-family tests. */
        dev = root_device_register(device_name);
-       if (!dev) {
+       if (IS_ERR(dev)) {
                pr_warn("Cannot register test device\n");
                return 1;
        }