Skip to content

Commit

Permalink
test_overflow: fix an IS_ERR() vs NULL bug
Browse files Browse the repository at this point in the history
root_device_register() returns error pointers, it never returns NULL.

Fixes: ca90800 ("test_overflow: Add memory allocation overflow tests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Dan Carpenter authored and kees committed Jun 12, 2018
1 parent d54d35c commit 8958fd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/test_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8958fd4

Please sign in to comment.