diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2018-07-12 16:10:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-12 16:23:19 +0200 |
commit | de8774371cdc4c18cd118490e0d61eccd5f2c4d8 (patch) | |
tree | 30fb1acac5d1fc5f5caeb47de3775f326a8112a2 /drivers/misc/mei/hw-txe.c | |
parent | mei: don't update offset in write (diff) | |
download | linux-de8774371cdc4c18cd118490e0d61eccd5f2c4d8.tar.xz linux-de8774371cdc4c18cd118490e0d61eccd5f2c4d8.zip |
mei: check for error returned from mei_hbuf_empty_slots()
mei_hbuf_empty_slots() may return with an error in case
of circular buffer overflow. This type of error may
be caused only by a bug. However currently, the error
won't be detected due signed type promotion in comparison to u32.
We add explicit check for less then zero and explicit cast
in comparison to suppress singn-compare warning.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hw-txe.c')
-rw-r--r-- | drivers/misc/mei/hw-txe.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c index c2c8993e2a51..4c1acf68089e 100644 --- a/drivers/misc/mei/hw-txe.c +++ b/drivers/misc/mei/hw-txe.c @@ -709,7 +709,7 @@ static int mei_txe_write(struct mei_device *dev, struct mei_txe_hw *hw = to_txe_hw(dev); unsigned long rem; unsigned long length; - int slots = dev->hbuf_depth; + u32 slots = dev->hbuf_depth; u32 *reg_buf = (u32 *)buf; u32 dw_cnt; int i; |