Skip to content

Commit

Permalink
mei: fix format string in debug prints
Browse files Browse the repository at this point in the history
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: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexander Usyskin authored and Greg Kroah-Hartman committed Feb 20, 2016
1 parent 941943c commit 35bf769
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/misc/mei/amthif.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
* remove message from deletion list
*/

dev_dbg(dev->dev, "amthif cb->buf.size - %zd cb->buf_idx - %zd\n",
dev_dbg(dev->dev, "amthif cb->buf.size - %zu cb->buf_idx - %zu\n",
cb->buf.size, cb->buf_idx);

/* length is being truncated to PAGE_SIZE, however,
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/mei/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
return 0;
}

cl_dbg(dev, cl, "buf: size = %zd idx = %zd\n",
cl_dbg(dev, cl, "buf: size = %zu idx = %zu\n",
cb->buf.size, cb->buf_idx);

rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx);
Expand Down
6 changes: 3 additions & 3 deletions drivers/misc/mei/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
buf_sz = mei_hdr->length + cb->buf_idx;
/* catch for integer overflow */
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);

list_move_tail(&cb->list, &complete_list->list);
Expand All @@ -137,7 +137,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
}

if (cb->buf.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->buf.size, mei_hdr->length, cb->buf_idx);
buffer = krealloc(cb->buf.data, buf_sz, GFP_KERNEL);

Expand All @@ -156,7 +156,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
cb->buf_idx += mei_hdr->length;

if (mei_hdr->msg_complete) {
cl_dbg(dev, cl, "completed read length = %lu\n", cb->buf_idx);
cl_dbg(dev, cl, "completed read length = %zu\n", cb->buf_idx);
list_move_tail(&cb->list, &complete_list->list);
} else {
pm_runtime_mark_last_busy(dev->dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
goto free;
}

cl_dbg(dev, cl, "buf.size = %zd buf.idx = %zd offset = %lld\n",
cl_dbg(dev, cl, "buf.size = %zu buf.idx = %zu offset = %lld\n",
cb->buf.size, cb->buf_idx, *offset);
if (*offset >= cb->buf_idx) {
rets = 0;
Expand Down

0 comments on commit 35bf769

Please sign in to comment.