From: Dan Carpenter Date: Tue, 12 Jun 2018 12:04:33 +0000 (+0300) Subject: test_overflow: fix an IS_ERR() vs NULL bug X-Git-Tag: v4.19~793^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8958fd411ba08aa3ac1aeb19828abaf9cf33f7b8;p=platform%2Fkernel%2Flinux-rpi3.git test_overflow: fix an IS_ERR() vs NULL bug root_device_register() returns error pointers, it never returns NULL. Fixes: ca90800a91ba ("test_overflow: Add memory allocation overflow tests") Signed-off-by: Dan Carpenter Signed-off-by: Kees Cook --- diff --git a/lib/test_overflow.c b/lib/test_overflow.c index aecbbb2..2278fe0 100644 --- a/lib/test_overflow.c +++ b/lib/test_overflow.c @@ -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; }