summaryrefslogtreecommitdiffstats
path: root/drivers/staging/wfx
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2020-05-12 17:04:04 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-13 13:49:43 +0200
commit270f54b83f89ca45cdc4dc1908de30cdbc4845d4 (patch)
tree3bd3287d9d015b9fb9af9736a8257e8cb015a357 /drivers/staging/wfx
parentea097de7ec4408fc952041da5560cf8a9ae65235 (diff)
downloadlinux-270f54b83f89ca45cdc4dc1908de30cdbc4845d4.tar.bz2
staging: wfx: fix endianness of hif_req_read_mib fields
The structs hif_{req,cnf}_read_mib contain only little endian values. Thus, it is necessary to fix byte ordering before to use them. Especially, sparse detected wrong accesses to fields mib_id and length. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200512150414.267198-8-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx')
-rw-r--r--drivers/staging/wfx/hif_tx.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 58013c019192..490a9de54faf 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -189,17 +189,17 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
wfx_fill_header(hif, vif_id, HIF_REQ_ID_READ_MIB, sizeof(*body));
ret = wfx_cmd_send(wdev, hif, reply, buf_len, false);
- if (!ret && mib_id != reply->mib_id) {
+ if (!ret && mib_id != le16_to_cpu(reply->mib_id)) {
dev_warn(wdev->dev,
"%s: confirmation mismatch request\n", __func__);
ret = -EIO;
}
if (ret == -ENOMEM)
- dev_err(wdev->dev,
- "buffer is too small to receive %s (%zu < %d)\n",
- get_mib_name(mib_id), val_len, reply->length);
+ dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n",
+ get_mib_name(mib_id), val_len,
+ le16_to_cpu(reply->length));
if (!ret)
- memcpy(val, &reply->mib_data, reply->length);
+ memcpy(val, &reply->mib_data, le16_to_cpu(reply->length));
else
memset(val, 0xFF, val_len);
kfree(hif);