Commit 6efef4d6 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Ben Hutchings

mei: fix format string in debug prints

commit 35bf7692 upstream.

buf_idx type was changed to size_t, and few places
missed out to change the print format from %ld to %zu.
Use also uz for buf.size which is also of size_t

Fixes:
commit 56988f22e097 ("mei: fix possible integer overflow issue")'
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>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 2e7adcd5
...@@ -234,7 +234,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, ...@@ -234,7 +234,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
* remove message from deletion list * remove message from deletion list
*/ */
dev_dbg(&dev->pdev->dev, "amthif cb->response_buffer.size - %zd cb->buf_idx - %zd\n", dev_dbg(&dev->pdev->dev, "amthif cb->response_buffer.size - %zu cb->buf_idx - %zu\n",
cb->response_buffer.size, cb->buf_idx); cb->response_buffer.size, cb->buf_idx);
/* length is being truncated to PAGE_SIZE, however, /* length is being truncated to PAGE_SIZE, however,
......
...@@ -849,7 +849,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -849,7 +849,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
return 0; return 0;
} }
cl_dbg(dev, cl, "buf: size = %zd idx = %zd\n", cl_dbg(dev, cl, "buf: size = %zu idx = %zu\n",
cb->request_buffer.size, cb->buf_idx); cb->request_buffer.size, cb->buf_idx);
rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx); rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx);
......
...@@ -121,7 +121,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, ...@@ -121,7 +121,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
buf_sz = mei_hdr->length + cb->buf_idx; buf_sz = mei_hdr->length + cb->buf_idx;
/* catch for integer overflow */ /* catch for integer overflow */
if (buf_sz < cb->buf_idx) { if (buf_sz < cb->buf_idx) {
cl_err(dev, cl, "message is too big len %d idx %ld\n", cl_err(dev, cl, "message is too big len %d idx %zu\n",
mei_hdr->length, cb->buf_idx); mei_hdr->length, cb->buf_idx);
list_del(&cb->list); list_del(&cb->list);
...@@ -129,7 +129,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, ...@@ -129,7 +129,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
} }
if (cb->response_buffer.size < buf_sz) { if (cb->response_buffer.size < buf_sz) {
cl_dbg(dev, cl, "message overflow. size %zd len %d idx %zd\n", cl_dbg(dev, cl, "message overflow. size %zu len %d idx %zu\n",
cb->response_buffer.size, cb->response_buffer.size,
mei_hdr->length, cb->buf_idx); mei_hdr->length, cb->buf_idx);
buffer = krealloc(cb->response_buffer.data, buf_sz, GFP_KERNEL); buffer = krealloc(cb->response_buffer.data, buf_sz, GFP_KERNEL);
...@@ -150,7 +150,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, ...@@ -150,7 +150,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
if (mei_hdr->msg_complete) { if (mei_hdr->msg_complete) {
cl->status = 0; cl->status = 0;
list_del(&cb->list); list_del(&cb->list);
cl_dbg(dev, cl, "completed read length = %lu\n", cl_dbg(dev, cl, "completed read length = %zu\n",
cb->buf_idx); cb->buf_idx);
list_add_tail(&cb->list, &complete_list->list); list_add_tail(&cb->list, &complete_list->list);
} }
......
...@@ -262,7 +262,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, ...@@ -262,7 +262,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
} }
/* now copy the data to user space */ /* now copy the data to user space */
copy_buffer: copy_buffer:
dev_dbg(&dev->pdev->dev, "buf.size = %zd buf.idx = %zd\n", dev_dbg(&dev->pdev->dev, "buf.size = %zu buf.idx = %zu\n",
cb->response_buffer.size, cb->buf_idx); cb->response_buffer.size, cb->buf_idx);
if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) { if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) {
rets = -EMSGSIZE; rets = -EMSGSIZE;
......
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