diff options
Diffstat (limited to 'drivers/hwtracing/intel_th/msu.c')
-rw-r--r-- | drivers/hwtracing/intel_th/msu.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index 70ca27e45602..d9d6022c5aca 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -408,7 +408,7 @@ msc_buffer_iterate(struct msc_iter *iter, size_t size, void *data, * Second time (wrap_count==1), it's just like any other block, * containing data in the range of [MSC_BDESC..data_bytes]. */ - if (iter->block == iter->start_block && iter->wrap_count) { + if (iter->block == iter->start_block && iter->wrap_count == 2) { tocopy = DATA_IN_PAGE - data_bytes; src += data_bytes; } @@ -1112,12 +1112,11 @@ static ssize_t intel_th_msc_read(struct file *file, char __user *buf, size = msc->nr_pages << PAGE_SHIFT; if (!size) - return 0; + goto put_count; - if (off >= size) { - len = 0; + if (off >= size) goto put_count; - } + if (off + len >= size) len = size - off; |