Skip to content

Commit 8e3ef7b

Browse files
Colin Ian Kinggregkh
authored andcommitted
intel_th: msu: Fix overflow in shift of an unsigned int
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: 615c164 ("intel_th: msu: Introduce buffer interface") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 063f097 commit 8e3ef7b

File tree

1 file changed

+1
-1
lines changed
  • drivers/hwtracing/intel_th

1 file changed

+1
-1
lines changed

drivers/hwtracing/intel_th/msu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static size_t msc_win_total_sz(struct msc_window *win)
327327
struct msc_block_desc *bdesc = sg_virt(sg);
328328

329329
if (msc_block_wrapped(bdesc))
330-
return win->nr_blocks << PAGE_SHIFT;
330+
return (size_t)win->nr_blocks << PAGE_SHIFT;
331331

332332
size += msc_total_sz(bdesc);
333333
if (msc_block_last_written(bdesc))

0 commit comments

Comments
 (0)