Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934772AbcCKIIY (ORCPT ); Fri, 11 Mar 2016 03:08:24 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:22560 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934359AbcCKIIO (ORCPT ); Fri, 11 Mar 2016 03:08:14 -0500 Date: Fri, 11 Mar 2016 11:07:47 +0300 From: Dan Carpenter To: Andrew Morton , Vivek Goyal Cc: Dave Young , Xunlei Pang , Ingo Molnar , Toshi Kani , Mimi Zohar , Minfei Huang , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] kexec: potetially using uninitialized variable Message-ID: <20160311080747.GA31887@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 605 Lines: 19 At the end of the function we check if "ret" has a negative error code, but it seems possible that it is uninitialized. Fixes: 12db5562e035 ('kexec: load and relocate purgatory at kernel load time') Signed-off-by: Dan Carpenter diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 503bc2d..63d1af3 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -795,7 +795,7 @@ out: static int kexec_apply_relocations(struct kimage *image) { - int i, ret; + int i, ret = 0; struct purgatory_info *pi = &image->purgatory_info; Elf_Shdr *sechdrs = pi->sechdrs;