Date: Thu, 30 May 2019 15:07:39 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348422 - head/usr.sbin/mpsutil Message-ID: <201905301507.x4UF7dOt020158@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu May 30 15:07:39 2019 New Revision: 348422 URL: https://svnweb.freebsd.org/changeset/base/348422 Log: Pass data pointers to the driver in way in expects. Probably due to historical reasons the driver uses In/Out arguments in odd way. While this tool still never uses Out arguments to see that, make the code to not trigger EINVAL in possible future uses. MFC after: 2 weeks Modified: head/usr.sbin/mpsutil/mps_cmd.c Modified: head/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- head/usr.sbin/mpsutil/mps_cmd.c Thu May 30 15:04:09 2019 (r348421) +++ head/usr.sbin/mpsutil/mps_cmd.c Thu May 30 15:07:39 2019 (r348422) @@ -651,27 +651,32 @@ mps_pass_command(int fd, void *req, uint32_t req_len, { struct mprs_pass_thru pass; + bzero(&pass, sizeof(pass)); pass.PtrRequest = (uint64_t)(uintptr_t)req; pass.PtrReply = (uint64_t)(uintptr_t)reply; - pass.PtrData = (uint64_t)(uintptr_t)data_in; - pass.PtrDataOut = (uint64_t)(uintptr_t)data_out; pass.RequestSize = req_len; pass.ReplySize = reply_len; - pass.DataSize = datain_len; - pass.DataOutSize = dataout_len; if (datain_len && dataout_len) { + pass.PtrData = (uint64_t)(uintptr_t)data_in; + pass.PtrDataOut = (uint64_t)(uintptr_t)data_out; + pass.DataSize = datain_len; + pass.DataOutSize = dataout_len; if (is_mps) { pass.DataDirection = MPS_PASS_THRU_DIRECTION_BOTH; } else { pass.DataDirection = MPR_PASS_THRU_DIRECTION_BOTH; } } else if (datain_len) { + pass.PtrData = (uint64_t)(uintptr_t)data_in; + pass.DataSize = datain_len; if (is_mps) { pass.DataDirection = MPS_PASS_THRU_DIRECTION_READ; } else { pass.DataDirection = MPR_PASS_THRU_DIRECTION_READ; } } else if (dataout_len) { + pass.PtrData = (uint64_t)(uintptr_t)data_out; + pass.DataSize = dataout_len; if (is_mps) { pass.DataDirection = MPS_PASS_THRU_DIRECTION_WRITE; } else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905301507.x4UF7dOt020158>