Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1328614 > unrolled thread

[char-misc-next 05/27] mei: amthif: don't copy from an empty buffer

Started byTomas Winkler <tomas.winkler@intel.com>
First post2016-02-07 22:50 +0100
Last post2016-02-07 22:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [char-misc-next 05/27] mei: amthif: don't copy from an empty buffer Tomas Winkler <tomas.winkler@intel.com> - 2016-02-07 22:50 +0100

#1328614 — [char-misc-next 05/27] mei: amthif: don't copy from an empty buffer

FromTomas Winkler <tomas.winkler@intel.com>
Date2016-02-07 22:50 +0100
Subject[char-misc-next 05/27] mei: amthif: don't copy from an empty buffer
Message-ID<qZFnr-3H1-5@gated-at.bofh.it>
From: Alexander Usyskin <alexander.usyskin@intel.com>

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: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/amthif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index b753df98b476..c3f514027c80 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -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 (cb->buf_idx >= *offset && length >= (cb->buf_idx - *offset))
 		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 */
 		list_del_init(&cb->list);
 		rets = 0;
-- 
2.4.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web