]> git.openfabrics.org - ~adrianc/mstflint.git/commitdiff
Fix uninitialized variables:
authorAna Guerrero López <ana@debian.org>
Tue, 1 Sep 2015 14:51:29 +0000 (16:51 +0200)
committerAdrian Chiris <adrianc@mellanox.com>
Wed, 2 Sep 2015 06:32:25 +0000 (09:32 +0300)
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<u_int8_t> imageInfoSect = imageInfoToc->section_data;

Signed-off-by: Ana Guerrero López <ana@ekaia.org>
Signed-off-by: Adrian Chiris <adrianc@mellanox.com>
mlxfwops/lib/fs3_ops.cpp

index c0fbcccbbf315f5c5ba9947b91fb4f3c6e04cb71..88c9d3c8b2d2176df4ed89185f4751ad7856e286 100644 (file)
@@ -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<u_int8_t> newUidSection;
     u_int32_t newSectionAddr;
     const char *type_msg;