smartmontools/smartmontools-5.40-megaraid.patch

34 lines
1.1 KiB
Diff

diff -up smartmontools-5.39.1/os_linux.cpp.megaraid smartmontools-5.39.1/os_linux.cpp
--- smartmontools-5.39.1/os_linux.cpp.megaraid 2010-01-28 21:24:32.000000000 +0100
+++ smartmontools-5.39.1/os_linux.cpp 2010-11-15 12:58:56.648181400 +0100
@@ -1095,17 +1095,21 @@ bool linux_megaraid_device::megasas_cmd(
pthru->cdb_len = cdbLen;
pthru->timeout = 0;
pthru->flags = MFI_FRAME_DIR_READ;
- pthru->sge_count = 1;
- pthru->data_xfer_len = dataLen;
- pthru->sgl.sge32[0].phys_addr = (intptr_t)data;
- pthru->sgl.sge32[0].length = (uint32_t)dataLen;
+ if (dataLen > 0) {
+ pthru->sge_count = 1;
+ pthru->data_xfer_len = dataLen;
+ pthru->sgl.sge32[0].phys_addr = (intptr_t)data;
+ pthru->sgl.sge32[0].length = (uint32_t)dataLen;
+ }
memcpy(pthru->cdb, cdb, cdbLen);
uio.host_no = m_hba;
- uio.sge_count = 1;
- uio.sgl_off = offsetof(struct megasas_pthru_frame, sgl);
- uio.sgl[0].iov_base = data;
- uio.sgl[0].iov_len = dataLen;
+ if (dataLen > 0) {
+ uio.sge_count = 1;
+ uio.sgl_off = offsetof(struct megasas_pthru_frame, sgl);
+ uio.sgl[0].iov_base = data;
+ uio.sgl[0].iov_len = dataLen;
+ }
rc = 0;
errno = 0;