Fix mstflint segment fault issue for ConnectX-5 HCA

Resolves: 1679844

Signed-off-by: Honggang Li <honli@redhat.com>
This commit is contained in:
Honggang Li 2019-02-22 10:58:07 +08:00
parent c600aaa732
commit 4d9bba1983
2 changed files with 33 additions and 1 deletions

View File

@ -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<u_int8_t> 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<u_int8_t> 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);

View File

@ -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 <honli@redhat.com> - 4.11.0-4
- Fix mstflint segment fault issue for ConnectX-5 HCA
- Resolves: 1679844
* Tue Feb 12 2019 Honggang Li <honli@redhat.com> - 4.11.0-3
- Rebase mstflint to latest upstream release v4.11.0-3
- Resolves: 1676338