diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-11-18 14:58:00 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-11-19 17:12:59 +0000 |
commit | 2fc2b4846c14c8c2d2c6e9114b4548f846521cfb (patch) | |
tree | a0ac1c77014dc151642b787e4d68608c06fd7e36 /drivers/mfd | |
parent | 00ee7a37fdc3ed9bc6315f8af0270f2df55437d7 (diff) | |
download | linux-2fc2b4846c14c8c2d2c6e9114b4548f846521cfb.tar.bz2 |
mfd: dln2: A couple endian fixes
Sparse catches a couple endian bugs.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/dln2.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c index df2fda9cd3db..559e6cc3e022 100644 --- a/drivers/mfd/dln2.c +++ b/drivers/mfd/dln2.c @@ -436,6 +436,7 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, struct device *dev = &dln2->interface->dev; const unsigned long timeout = DLN2_USB_TIMEOUT * HZ / 1000; struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle]; + int size; spin_lock(&dln2->disconnect_lock); if (!dln2->disconnect) @@ -477,8 +478,9 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, /* if we got here we know that the response header has been checked */ rsp = rxc->urb->transfer_buffer; + size = le16_to_cpu(rsp->hdr.size); - if (rsp->hdr.size < sizeof(*rsp)) { + if (size < sizeof(*rsp)) { ret = -EPROTO; goto out_free_rx_slot; } @@ -493,8 +495,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, if (!ibuf) goto out_free_rx_slot; - if (*ibuf_len > rsp->hdr.size - sizeof(*rsp)) - *ibuf_len = rsp->hdr.size - sizeof(*rsp); + if (*ibuf_len > size - sizeof(*rsp)) + *ibuf_len = size - sizeof(*rsp); memcpy(ibuf, rsp + 1, *ibuf_len); |