diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-04-19 22:01:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-19 13:38:38 -0700 |
commit | fcb136e1ac5774909e0d85189f721b8dfa800e0f (patch) | |
tree | ac89a706d67783063d4f752c3acddc04c5ab10e8 /drivers/misc/mei/client.c | |
parent | 6e0f180fd8b47fa0884177a142e41a86117edc23 (diff) | |
download | blackbird-op-linux-fcb136e1ac5774909e0d85189f721b8dfa800e0f.tar.gz blackbird-op-linux-fcb136e1ac5774909e0d85189f721b8dfa800e0f.zip |
mei: fix reading large reposnes
While writting to device is limitted to max_msg_length advertized
in client properites the read can be much longer delivered consequiting chunks.
We use krealloc to enlarge the buffer when needed.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/client.c')
-rw-r--r-- | drivers/misc/mei/client.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 9541aa90d8f7..71892745e2e8 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -624,7 +624,7 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl) * * returns 0 on success, <0 on failure. */ -int mei_cl_read_start(struct mei_cl *cl) +int mei_cl_read_start(struct mei_cl *cl, size_t length) { struct mei_device *dev; struct mei_cl_cb *cb; @@ -657,8 +657,9 @@ int mei_cl_read_start(struct mei_cl *cl) if (!cb) return -ENOMEM; - rets = mei_io_cb_alloc_resp_buf(cb, - dev->me_clients[i].props.max_msg_length); + /* always allocate at least client max message */ + length = max_t(size_t, length, dev->me_clients[i].props.max_msg_length); + rets = mei_io_cb_alloc_resp_buf(cb, length); if (rets) goto err; |