diff options
author | Jason M. Bills <jason.m.bills@intel.com> | 2022-03-02 18:58:33 +0300 |
---|---|---|
committer | jmbills <jasonm.bills@yahoo.com> | 2022-03-11 00:27:19 +0300 |
commit | 246e36dba646e1fc5176e536bf9e80b2a3a6ba5f (patch) | |
tree | 048af9d31dc3be4ebf1f102f27264947b4573d6a /drivers/peci | |
parent | f99c8aa5142aaa83cb19aaacf2166dafbb3828aa (diff) | |
download | linux-246e36dba646e1fc5176e536bf9e80b2a3a6ba5f.tar.xz |
peci: add msg_len to peci_command
To support the new domain ID, we need to include an extra byte from
userspace. This adds a length to the peci_command function so we can
detect when the domain ID is sent from userspace.
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
Diffstat (limited to 'drivers/peci')
-rw-r--r-- | drivers/peci/peci-core.c | 6 | ||||
-rw-r--r-- | drivers/peci/peci-dev.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c index 72d9a909125b..2638a0f33610 100644 --- a/drivers/peci/peci-core.c +++ b/drivers/peci/peci-core.c @@ -1190,7 +1190,7 @@ static const peci_cmd_fn_type peci_cmd_fn[PECI_CMD_MAX] = { * * Return: zero on success, else a negative error code. */ -int peci_command(struct peci_adapter *adapter, enum peci_cmd cmd, void *vmsg) +int peci_command(struct peci_adapter *adapter, enum peci_cmd cmd, uint msg_len, void *vmsg) { int ret; @@ -1220,7 +1220,7 @@ static int peci_detect(struct peci_adapter *adapter, u8 addr) msg.addr = addr; - return peci_command(adapter, PECI_CMD_PING, &msg); + return peci_command(adapter, PECI_CMD_PING, sizeof(msg), &msg); } static const struct of_device_id * @@ -1386,7 +1386,7 @@ int peci_get_cpu_id(struct peci_adapter *adapter, u8 addr, u32 *cpu_id) msg.param = PECI_PKG_ID_CPU_ID; msg.rx_len = 4; - ret = peci_command(adapter, PECI_CMD_RD_PKG_CFG, &msg); + ret = peci_command(adapter, PECI_CMD_RD_PKG_CFG, sizeof(msg), &msg); if (msg.cc != PECI_DEV_CC_SUCCESS) ret = -EAGAIN; if (ret) diff --git a/drivers/peci/peci-dev.c b/drivers/peci/peci-dev.c index 8104468864bf..f02666984ce7 100644 --- a/drivers/peci/peci-dev.c +++ b/drivers/peci/peci-dev.c @@ -143,7 +143,7 @@ static long peci_dev_ioctl(struct file *file, uint iocmd, ulong arg) * either success or timeout to provide the completion code to * the caller. */ - ret = peci_command(peci_dev->adapter, cmd, xmsg); + ret = peci_command(peci_dev->adapter, cmd, msg_len, xmsg); if ((!ret || ret == -ETIMEDOUT) && xmsg->rx_len && copy_to_user((__u8 __user *)uxmsg.rx_buf, xmsg->rx_buf, xmsg->rx_len)) @@ -163,7 +163,7 @@ static long peci_dev_ioctl(struct file *file, uint iocmd, ulong arg) * either success or timeout to provide the completion code to * the caller. */ - ret = peci_command(peci_dev->adapter, cmd, msg); + ret = peci_command(peci_dev->adapter, cmd, msg_len, msg); if ((!ret || ret == -ETIMEDOUT) && copy_to_user(umsg, msg, msg_len)) ret = -EFAULT; |