svn commit: r348422 - head/usr.sbin/mpsutil
Alexander Motin
mav at FreeBSD.org
Thu May 30 15:07:40 UTC 2019
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 {
More information about the svn-src-all
mailing list