OSDN Git Service

mei: check for error returned from mei_hbuf_empty_slots()
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 12 Jul 2018 14:10:08 +0000 (17:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jul 2018 14:23:19 +0000 (16:23 +0200)
commitde8774371cdc4c18cd118490e0d61eccd5f2c4d8
tree30fb1acac5d1fc5f5caeb47de3775f326a8112a2
parenta103af1b64d74853a5e08ca6c86aeb0e5c6ca4f1
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>
drivers/misc/mei/client.c
drivers/misc/mei/hw-me.c
drivers/misc/mei/hw-txe.c
drivers/misc/mei/interrupt.c