coredump: initialize coredump_size in submit_coredump() (#4219)
authorMatej Habrnal <mhabrnal@redhat.com>
Mon, 26 Sep 2016 15:28:58 +0000 (17:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 26 Sep 2016 15:28:58 +0000 (11:28 -0400)
If ulimit is smaller than page_size(), function save_external_coredump()
returns -EBADSLT and this causes skipping whole core dumping part in
submit_coredump(). Initializing coredump_size to UINT64_MAX prevents
evaluating a condition with uninitialized varialbe which leads to
calling allocate_journal_field() with coredump_fd = -1 which causes
aborting.

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
src/coredump/coredump.c

index 9dea10b..7cc3f3f 100644 (file)
@@ -678,7 +678,7 @@ static int submit_coredump(
 
         _cleanup_close_ int coredump_fd = -1, coredump_node_fd = -1;
         _cleanup_free_ char *core_message = NULL, *filename = NULL, *coredump_data = NULL;
-        uint64_t coredump_size;
+        uint64_t coredump_size = UINT64_MAX;
         int r;
 
         assert(context);