zlogger: fix potential NULL pointer dereference 26/285426/1 accepted/tizen/unified/20221219.024717
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 12 Dec 2022 13:30:40 +0000 (14:30 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 12 Dec 2022 13:30:40 +0000 (14:30 +0100)
Change-Id: I32ddd832bb9ece441fbe93e88b8d363b79e82487
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
kernel/zlogger/zlogger.c

index 7652f5b..e0df44e 100644 (file)
@@ -163,6 +163,8 @@ static struct thread_table_field *set_thread_table(pid_t tid, bool is_stdout, ui
        }
 
        ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
+       if (!ptr)
+               return NULL;
        ptr->tid = tid;
        ptr->is_stdout = is_stdout;
        ptr->blk = blk;
@@ -324,6 +326,8 @@ static struct thread_table_field *alloc_block_for_thread(bool is_stdout)
                return NULL;
        }
        ptr = set_thread_table(tid, is_stdout, blk);
+       if (!ptr)
+               return NULL;
        block = get_block(blk);
 
        /* security: ensure mmaped block doesn't leak any information */