[PATCH] staging: most: fix possible overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes a possible overflow in module hdm-dim2.

Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
---
 drivers/staging/most/hdm-dim2/dim2_hdm.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index dda02a6..855bcd2 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -381,11 +381,12 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx)
 			if (hdm_ch->data_type == MOST_CH_CONTROL ||
 			    hdm_ch->data_type == MOST_CH_ASYNC) {
 
-				u16 const data_size =
-					(u16)data[0] * 256 + data[1] + 2;
+				u32 data_size =
+					(u32)data[0] * 256 + data[1] + 2;
 
 				mbo->processed_length =
-					min(data_size, mbo->buffer_length);
+					min_t(u32, data_size,
+					      mbo->buffer_length);
 			} else {
 				mbo->processed_length = mbo->buffer_length;
 			}
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux