[Pkg-ofed-commits] [mstflint] 02/03: Add patches to fix FTBFS.

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Tue Sep 1 14:32:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

ana pushed a commit to branch master
in repository mstflint.

commit fa8e332c7dd573243d5f75f800c10dddf1774629
Author: Ana Guerrero López <ana at ekaia.org>
Date:   Tue Sep 1 16:04:03 2015 +0200

    Add patches to fix FTBFS.
    
    add fix_Werror=maybe-uninitialized
    add fix_Werror=sizeof-array-argument
---
 debian/changelog                                |  3 ++
 debian/patches/fix_Werror=maybe-uninitialized   | 45 +++++++++++++++++++++++++
 debian/patches/fix_Werror=sizeof-array-argument | 34 +++++++++++++++++++
 debian/patches/series                           |  2 ++
 4 files changed, 84 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index aa4f4ca..f44fafe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 mstflint (4.0.1+1.43.g97d7275-2) UNRELEASED; urgency=medium
 
   * Add fields Vcs-Browser/Vcs-Git.
+  * Add patches to fix FTBFS:
+    - fix_Werror=maybe-uninitialized
+    - fix_Werror=sizeof-array-argument
 
  -- Ana Beatriz Guerrero Lopez <ana at debian.org>  Tue, 01 Sep 2015 15:30:04 +0200
 
diff --git a/debian/patches/fix_Werror=maybe-uninitialized b/debian/patches/fix_Werror=maybe-uninitialized
new file mode 100644
index 0000000..38b828c
--- /dev/null
+++ b/debian/patches/fix_Werror=maybe-uninitialized
@@ -0,0 +1,45 @@
+Description: 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<u_int8_t> imageInfoSect = imageInfoToc->section_data;
+Author: Ana Guerrero López <ana at debian.org>
+
+Index: mstflint/mlxfwops/lib/fs3_ops.cpp
+===================================================================
+--- mstflint.orig/mlxfwops/lib/fs3_ops.cpp
++++ mstflint/mlxfwops/lib/fs3_ops.cpp
+@@ -1060,7 +1060,7 @@ bool Fs3Operations::Fs3Burn(Fs3Operation
+         // 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("failed to get Image Info section.");
+             }
+@@ -1715,7 +1715,7 @@ bool Fs3Operations::Fs3GetNewSectionAddr
+ 
+     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;
+ 
+@@ -1806,7 +1806,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;
diff --git a/debian/patches/fix_Werror=sizeof-array-argument b/debian/patches/fix_Werror=sizeof-array-argument
new file mode 100644
index 0000000..1556d95
--- /dev/null
+++ b/debian/patches/fix_Werror=sizeof-array-argument
@@ -0,0 +1,34 @@
+Description: Do not use sizeof for array parameters.
+It's not the most elegant of the fixes but properly fixing this requires
+rewriting the function.
+
+vpd.c: In function 'pci_read_vpd_dword_gw':
+vpd.c:223:31: error: 'sizeof' on array function parameter 'data' will return size of 'unsigned char *' [-Werror=sizeof-array-argument]
+  ret = pread(fd, data, sizeof data, vpd_cap_offset + VPD_DATA_OFFSET);
+                               ^
+vpd.c:189:86: note: declared here
+ int pci_read_vpd_dword_gw(int fd, int vpd_cap_offset, unsigned offset, unsigned char data[4])
+                                                                                      ^
+vpd.c:224:20: error: 'sizeof' on array function parameter 'data' will return size of 'unsigned char *' [-Werror=sizeof-array-argument]
+  if (ret != sizeof data) {
+                    ^
+vpd.c:189:86: note: declared here
+ int pci_read_vpd_dword_gw(int fd, int vpd_cap_offset, unsigned offset, unsigned char data[4])
+Author: Ana Guerrero López <ana at debian.org>
+
+
+Index: mstflint/small_utils/vpd.c
+===================================================================
+--- mstflint.orig/small_utils/vpd.c
++++ mstflint/small_utils/vpd.c
+@@ -220,8 +220,8 @@ int pci_read_vpd_dword_gw(int fd, int vp
+ 		}
+ 	}
+ 
+-	ret = pread(fd, data, sizeof data, vpd_cap_offset + VPD_DATA_OFFSET);
+-	if (ret != sizeof data) {
++	ret = pread(fd, data, 4, vpd_cap_offset + VPD_DATA_OFFSET);
++	if (ret != 4) {
+ 		return ret;
+ 	}
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ede70b6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+fix_Werror=maybe-uninitialized
+fix_Werror=sizeof-array-argument

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/mstflint.git



More information about the Pkg-ofed-commits mailing list