Date: Thu, 13 Jun 2019 01:23:03 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349007 - stable/12/usr.sbin/mpsutil Message-ID: <201906130123.x5D1N3oX015974@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Jun 13 01:23:03 2019 New Revision: 349007 URL: https://svnweb.freebsd.org/changeset/base/349007 Log: MFC r348422: 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. Modified: stable/12/usr.sbin/mpsutil/mps_cmd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- stable/12/usr.sbin/mpsutil/mps_cmd.c Thu Jun 13 01:21:32 2019 (r349006) +++ stable/12/usr.sbin/mpsutil/mps_cmd.c Thu Jun 13 01:23:03 2019 (r349007) @@ -652,27 +652,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?201906130123.x5D1N3oX015974>