瀏覽代碼

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 <dan.carpenter@oracle.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Dan Carpenter 7 年之前
父節點
當前提交
8958fd411b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/test_overflow.c

+ 1 - 1
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;
 	}