Package: mstflint
Version: 3.7.0+1.18.gcdb9f80-3
Followup-For: Bug #778016
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu vivid ubuntu-patch

Hi Ana,

In addition to failing to build under gcc 5, mstflint also fails to build
under gcc 4.9 with -O3 optimization.  As a result this package was failing
to build in Ubuntu on ppc64el (despite having had a patch included to
support ppc64el builds), where -O3 is used by default, and so I've prepared
the attached patch to fix the build.

This patch has been submitted upstream to Mohammed Sawalha
<moham...@mellanox.com>.

Hope that helps,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru mstflint-3.7.0+1.18.gcdb9f80/debian/changelog mstflint-3.7.0+1.18.gcdb9f80/debian/changelog
diff -Nru mstflint-3.7.0+1.18.gcdb9f80/debian/patches/series mstflint-3.7.0+1.18.gcdb9f80/debian/patches/series
--- mstflint-3.7.0+1.18.gcdb9f80/debian/patches/series	1969-12-31 16:00:00.000000000 -0800
+++ mstflint-3.7.0+1.18.gcdb9f80/debian/patches/series	2015-03-31 19:19:20.000000000 -0700
@@ -0,0 +1 @@
+uninitialized-variables-O3.patch
diff -Nru mstflint-3.7.0+1.18.gcdb9f80/debian/patches/uninitialized-variables-O3.patch mstflint-3.7.0+1.18.gcdb9f80/debian/patches/uninitialized-variables-O3.patch
--- mstflint-3.7.0+1.18.gcdb9f80/debian/patches/uninitialized-variables-O3.patch	1969-12-31 16:00:00.000000000 -0800
+++ mstflint-3.7.0+1.18.gcdb9f80/debian/patches/uninitialized-variables-O3.patch	2015-03-31 19:19:20.000000000 -0700
@@ -0,0 +1,82 @@
+Description: Fix uninitialized variables when building with -O3
+ When optimizing with -O3, gcc detects possible use-before-initialization
+ bugs in mlxfwops/lib/.  These are false positives but defy
+ compiler analysis, and it's better to be safe anyway so initialize the
+ variables explicitly.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1367842
+
+Index: mstflint-3.7.0+1.18.gcdb9f80/mlxfwops/lib/fw_ops.cpp
+===================================================================
+--- mstflint-3.7.0+1.18.gcdb9f80.orig/mlxfwops/lib/fw_ops.cpp
++++ mstflint-3.7.0+1.18.gcdb9f80/mlxfwops/lib/fw_ops.cpp
+@@ -623,8 +623,8 @@ bool FwOperations::writeImage(ProgressCa
+ 
+ bool FwOperations::ModifyImageFile(const char *fimage, u_int32_t addr, void *data, int cnt)
+ {
+-    int file_size;
+-    u_int8_t * file_data;
++    int file_size = 0;
++    u_int8_t * file_data = NULL;
+ 
+     if (!ReadImageFile(fimage, file_data, file_size, addr + cnt)) {
+         return false;
+Index: mstflint-3.7.0+1.18.gcdb9f80/mlxfwops/lib/fs2_ops.cpp
+===================================================================
+--- mstflint-3.7.0+1.18.gcdb9f80.orig/mlxfwops/lib/fs2_ops.cpp
++++ mstflint-3.7.0+1.18.gcdb9f80/mlxfwops/lib/fs2_ops.cpp
+@@ -452,8 +452,8 @@ bool Fs2Operations::Fs2Verify(VerifyCall
+ 
+      // Verify the images:
+      for (u_int32_t i = 0; i < cntx_image_num; i++) {
+-         bool      fs_en;
+-         u_int32_t log2chunk_size;
++         bool      fs_en = false;
++         u_int32_t log2chunk_size = 0;
+          u_int32_t buff[FS2_BOOT_START / 4];
+ 
+          _ioAccess->get_image_crc().clear();
+Index: mstflint-3.7.0+1.18.gcdb9f80/mlxfwops/lib/fs3_ops.cpp
+===================================================================
+--- mstflint-3.7.0+1.18.gcdb9f80.orig/mlxfwops/lib/fs3_ops.cpp
++++ mstflint-3.7.0+1.18.gcdb9f80/mlxfwops/lib/fs3_ops.cpp
+@@ -975,7 +975,7 @@ bool Fs3Operations::FwSetVPD(char* vpdFi
+ bool Fs3Operations::GetModifiedSectionInfo(fs3_section_t sectionType, fs3_section_t nextSectionType, u_int32_t &newSectAddr,
+         fs3_section_t &SectToPut, u_int32_t &oldSectSize)
+ {
+-    struct toc_info *curr_itoc;
++    struct toc_info *curr_itoc = NULL;
+     if (Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, sectionType, curr_itoc) ||
+         Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, nextSectionType, curr_itoc)) {
+         newSectAddr = curr_itoc->toc_entry.flash_addr << 2;
+@@ -1024,9 +1024,10 @@ bool Fs3Operations::UpdateItocAfterInser
+ 
+     if (toAdd) {
+         if (isReplacement) {
+-            struct toc_info *curr_itoc;
++            struct toc_info *curr_itoc = NULL;
+             u_int32_t sectSize;
+-            Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, sectionType, curr_itoc);
++            if (!Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, sectionType, curr_itoc))
++                return false;
+             sectSize = curr_itoc->toc_entry.size * 4;
+             shiftSize = (removedOrNewSectSize > sectSize) ? removedOrNewSectSize - sectSize : 0;
+         } else {
+@@ -1404,7 +1405,7 @@ bool Fs3Operations::Fs3ReburnItocSection
+ //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;
+@@ -1658,7 +1659,7 @@ bool Fs3Operations::FwShiftDevData(Print
+ 	}
+ 
+ 	// check if we already shifted
+-	struct toc_info* mfgToc;
++	struct toc_info *mfgToc = NULL;
+ 	if (!Fs3GetItocInfo(_fs3ImgInfo.tocArr, _fs3ImgInfo.numOfItocs, FS3_MFG_INFO, mfgToc)) {
+ 		return errmsg("Failed to get MFG_INFO ITOC information.");
+ 	}

Reply via email to