Commit 5ba0bf47 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: amthif: don't copy from an empty buffer

If empty message come from FW (buf_idx == 0) then the current code will
still try to copy data from not filled buffer to the user-space,
instead the code should behave the same as when end of a message
has been reached, clean resources and return 0
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1f7e489a
...@@ -185,7 +185,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, ...@@ -185,7 +185,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
/* if the whole message will fit remove it from the list */ /* if the whole message will fit remove it from the list */
if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset)) if (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset))
list_del_init(&cb->list); list_del_init(&cb->list);
else if (cb->buf_idx > 0 && cb->buf_idx <= *offset) { else if (cb->buf_idx <= *offset) {
/* end of the message has been reached */ /* end of the message has been reached */
list_del_init(&cb->list); list_del_init(&cb->list);
rets = 0; rets = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment