From: Ana Guerrero López Date: Tue, 1 Sep 2015 14:51:29 +0000 (+0200) Subject: Fix uninitialized variables: X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=4921962b412b5a465ae52b2820d73af03ef11e52;p=~adrianc%2Fmstflint.git Fix uninitialized variables: fs3_ops.cpp: In member function 'bool Fs3Operations::Fs3GetNewSectionAddr(Fs3Operations::toc_info*, u_int32_t&, bool)': fs3_ops.cpp:1727:40: error: 'toc' may be used uninitialized in this function [-Werror=maybe-uninitialized] devInfoAddr1 = (toc->toc_entry.flash_addr << 2) - 0x1000; ^ fs3_ops.cpp: In member function 'bool Fs3Operations::Fs3UpdateSection(void*, fs3_section_t, bool, CommandType, PrintCallBack)': fs3_ops.cpp:1863:27: error: 'curr_toc' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (!Fs3UpdateItocInfo(curr_toc, newSectionAddr, curr_toc->toc_entry.size, newUidSection)) { ^ fs3_ops.cpp: In member function 'bool Fs3Operations::Fs3Burn(Fs3Operations&, FwOperations::ExtBurnParams&)': fs3_ops.cpp:1068:65: error: 'imageInfoToc' may be used uninitialized in this function [-Werror=maybe-uninitialized] std::vector imageInfoSect = imageInfoToc->section_data; Signed-off-by: Ana Guerrero López Signed-off-by: Adrian Chiris --- diff --git a/mlxfwops/lib/fs3_ops.cpp b/mlxfwops/lib/fs3_ops.cpp index c0fbccc..88c9d3c 100644 --- a/mlxfwops/lib/fs3_ops.cpp +++ b/mlxfwops/lib/fs3_ops.cpp @@ -1084,7 +1084,7 @@ bool Fs3Operations::Fs3Burn(Fs3Operations &imageOps, ExtBurnParams& burnParams) // image vsd patch if (!burnParams.useImagePs && burnParams.vsdSpecified ) { // get image info section : - struct toc_info *imageInfoToc; + struct toc_info *imageInfoToc = NULL; if (!imageOps.Fs3GetItocInfo(imageOps._fs3ImgInfo.tocArr, imageOps._fs3ImgInfo.numOfItocs, FS3_IMAGE_INFO, imageInfoToc)){ return errmsg(MLXFW_GET_SECT_ERR, "failed to get Image Info section."); } @@ -1757,7 +1757,7 @@ bool Fs3Operations::Fs3GetNewSectionAddr(struct toc_info *curr_toc, u_int32_t &N if (failsafe_section) {// we assume dev_info is the only FS section. // get the two dev_info addresses (section is failsafe) according to the location of the mfg section - toc_info* toc; + toc_info* toc = NULL; u_int32_t devInfoAddr1 = 0; u_int32_t devInfoAddr2 = 0; @@ -1848,7 +1848,7 @@ bool Fs3Operations::Fs3ReburnItocSection(u_int32_t newSectionAddr, //add callback if we want info during section update bool Fs3Operations::Fs3UpdateSection(void *new_info, fs3_section_t sect_type, bool is_sect_failsafe, CommandType cmd_type, PrintCallBack callBackFunc) { - struct toc_info *curr_toc; + struct toc_info *curr_toc = NULL; std::vector newUidSection; u_int32_t newSectionAddr; const char *type_msg;