livepatch: return -ENOMEM on ptr_id() allocation failure
authorJoe Lawrence <joe.lawrence@redhat.com>
Mon, 4 Feb 2019 13:56:51 +0000 (14:56 +0100)
committerPetr Mladek <pmladek@suse.com>
Wed, 6 Feb 2019 10:00:58 +0000 (11:00 +0100)
Fixes the following smatch warning:

  lib/livepatch/test_klp_shadow_vars.c:47 ptr_id() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Petr Mladek <pmladek@suse.com>
lib/livepatch/test_klp_shadow_vars.c

index 02f892f941dca6e94fdbde6707fad4af77fe8f39..f5441c193166d02b561900ef0a5edad2bef96444 100644 (file)
@@ -44,7 +44,7 @@ static int ptr_id(void *ptr)
 
        sp = kmalloc(sizeof(*sp), GFP_ATOMIC);
        if (!sp)
-               return -1;
+               return -ENOMEM;
        sp->ptr = ptr;
        sp->id = count++;