From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Colin Ian King <colin.king@canonical.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [GIT PULL 4/7] intel_th: msu: Fix overflow in shift of an unsigned int
Date: Mon, 28 Oct 2019 09:06:48 +0200 [thread overview]
Message-ID: <20191028070651.9770-5-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <20191028070651.9770-1-alexander.shishkin@linux.intel.com>
From: Colin Ian King <colin.king@canonical.com>
The shift of the unsigned int win->nr_blocks by PAGE_SHIFT may
potentially overflow. Note that the intended return of this shift
is expected to be a size_t however the shift is being performed as
an unsigned int. Fix this by casting win->nr_blocks to a size_t
before performing the shift.
Addresses-Coverity: ("Unintentional integer overflow")
Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/lkml/20190726113151.8967-1-colin.king@canonical.com/
---
drivers/hwtracing/intel_th/msu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 201a166fdff5..9dc9ae87b5e5 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -327,7 +327,7 @@ static size_t msc_win_total_sz(struct msc_window *win)
struct msc_block_desc *bdesc = sg_virt(sg);
if (msc_block_wrapped(bdesc))
- return win->nr_blocks << PAGE_SHIFT;
+ return (size_t)win->nr_blocks << PAGE_SHIFT;
size += msc_total_sz(bdesc);
if (msc_block_last_written(bdesc))
--
2.23.0
next prev parent reply other threads:[~2019-10-28 7:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 7:06 [GIT PULL 0/7] intel_th: Fixes for v5.4 Alexander Shishkin
2019-10-28 7:06 ` [GIT PULL 1/7] intel_th: gth: Fix the window switching sequence Alexander Shishkin
2019-11-02 17:14 ` Greg Kroah-Hartman
2019-11-04 6:25 ` Alexander Shishkin
2019-11-04 6:35 ` Greg Kroah-Hartman
2019-11-04 6:54 ` Alexander Shishkin
2019-10-28 7:06 ` [GIT PULL 2/7] intel_th: msu: Fix an uninitialized mutex Alexander Shishkin
2019-11-02 17:14 ` Greg Kroah-Hartman
2019-11-04 6:27 ` Alexander Shishkin
2019-10-28 7:06 ` [GIT PULL 3/7] intel_th: msu: Fix missing allocation failure check on a kstrndup Alexander Shishkin
2019-10-28 7:06 ` Alexander Shishkin [this message]
2019-10-28 7:06 ` [GIT PULL 5/7] intel_th: msu: Fix possible memory leak in mode_store() Alexander Shishkin
2019-10-28 7:06 ` [GIT PULL 6/7] intel_th: pci: Add Comet Lake PCH support Alexander Shishkin
2019-10-28 7:06 ` [GIT PULL 7/7] intel_th: pci: Add Jasper " Alexander Shishkin
2019-11-04 14:02 ` [GIT PULL 0/7] intel_th: Fixes for v5.4 Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191028070651.9770-5-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox