linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] test_overflow: fix an IS_ERR() vs NULL bug
@ 2018-06-12 12:04 Dan Carpenter
  2018-06-12 23:20 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-06-12 12:04 UTC (permalink / raw)
  To: Kees Cook; +Cc: Rasmus Villemoes, linux-kernel, kernel-janitors

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>

diff --git a/lib/test_overflow.c b/lib/test_overflow.c
index aecbbb217305..2278fe05a1b0 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;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test_overflow: fix an IS_ERR() vs NULL bug
  2018-06-12 12:04 [PATCH] test_overflow: fix an IS_ERR() vs NULL bug Dan Carpenter
@ 2018-06-12 23:20 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2018-06-12 23:20 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Rasmus Villemoes, LKML, kernel-janitors

On Tue, Jun 12, 2018 at 5:04 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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>

Ah! Thanks. I'll pull this into my overflow tree for Linus.

-Kees

>
> diff --git a/lib/test_overflow.c b/lib/test_overflow.c
> index aecbbb217305..2278fe05a1b0 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;
>         }



-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-12 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 12:04 [PATCH] test_overflow: fix an IS_ERR() vs NULL bug Dan Carpenter
2018-06-12 23:20 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).