From 4d9bba198323d12c82cde402be090ab85b3d1993 Mon Sep 17 00:00:00 2001 From: Honggang Li Date: Feb 22 2019 02:58:07 +0000 Subject: Fix mstflint segment fault issue for ConnectX-5 HCA Resolves: 1679844 Signed-off-by: Honggang Li --- diff --git a/0001-mstflint-crash-when-compiled-with-CXXFLAGS-Wp-D_GLIB.patch b/0001-mstflint-crash-when-compiled-with-CXXFLAGS-Wp-D_GLIB.patch new file mode 100644 index 0000000..2908b4b --- /dev/null +++ b/0001-mstflint-crash-when-compiled-with-CXXFLAGS-Wp-D_GLIB.patch @@ -0,0 +1,26 @@ +diff --git a/mlxfwops/lib/fs2_ops.cpp b/mlxfwops/lib/fs2_ops.cpp +index 775e242..4af0b9f 100644 +--- a/mlxfwops/lib/fs2_ops.cpp ++++ b/mlxfwops/lib/fs2_ops.cpp +@@ -369,7 +369,7 @@ bool Fs2Operations::checkGen(u_int32_t beg, u_int32_t offs, u_int32_t& next, con + // CRC + Crc16 crc; + std::vector buffv(size); +- u_int32_t *buff = (u_int32_t*)(&(buffv[0])); ++ u_int32_t *buff = (u_int32_t*)(buffv.size() ? (&(buffv[0])) : NULL); + + readBufAux((*_ioAccess), offs + sizeof(gph), buff, size, pr); + +diff --git a/mlxfwops/lib/fs4_ops.cpp b/mlxfwops/lib/fs4_ops.cpp +index eb0ca29..4b10307 100644 +--- a/mlxfwops/lib/fs4_ops.cpp ++++ b/mlxfwops/lib/fs4_ops.cpp +@@ -403,7 +403,7 @@ bool Fs4Operations::verifyTocEntries(u_int32_t tocAddr, bool show_itoc, bool isD + + // Only when we have full verify or the info of this section should be collected for query + std::vector buffv(entrySizeInBytes); +- u_int8_t *buff = (u_int8_t *)(&(buffv[0])); ++ u_int8_t *buff = (u_int8_t *)(buffv.size() ? (&(buffv[0])) : NULL); + + if (show_itoc) { + cx5fw_itoc_entry_dump(&tocEntry, stdout); diff --git a/mstflint.spec b/mstflint.spec index d4cfd4d..1ba8804 100644 --- a/mstflint.spec +++ b/mstflint.spec @@ -3,7 +3,7 @@ Name: mstflint Summary: Mellanox firmware burning tool Version: 4.11.0 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ or BSD Group: Applications/System Source: https://github.com/Mellanox/mstflint/releases/download/v4.11.0-3/mstflint-4.11.0-3.tar.gz @@ -11,6 +11,7 @@ Patch1: convert-format-for-mlxfwreset_status_checker.patch Patch2: 0001-Fix-shebang-for-python-scripts.patch Patch3: extend-buffer.patch Patch4: add-default-link-flags-for-shared-libraries.patch +Patch5: 0001-mstflint-crash-when-compiled-with-CXXFLAGS-Wp-D_GLIB.patch Patch6: replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch Url: https://github.com/Mellanox/mstflint BuildRequires: libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc @@ -32,6 +33,7 @@ for network adapters based on Mellanox Technologies chips. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %patch6 -p1 find . -type f -iname '*.[ch]' -exec chmod a-x '{}' ';' find . -type f -iname '*.cpp' -exec chmod a-x '{}' ';' @@ -69,6 +71,10 @@ find %{buildroot} -type f -name pci_device.py -exec chmod -v a+x '{}' ';' %{_mandir}/man1/* %changelog +* Fri Feb 22 2019 Honggang Li - 4.11.0-4 +- Fix mstflint segment fault issue for ConnectX-5 HCA +- Resolves: 1679844 + * Tue Feb 12 2019 Honggang Li - 4.11.0-3 - Rebase mstflint to latest upstream release v4.11.0-3 - Resolves: 1676338