Skip to contentSkip to conversation

siano: fix a potential integer overflow

PATCH New Gustavo A. R. Silva 1 participant 1 message Sep 20, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 siano: fix a potential integer overflow

Add suffix ULL to constant 65535 in order to avoid a potential integer overflow. This constant is used in a context that expects an expression of type u64.

Addresses-Coverity-ID: 1056806

---
 drivers/media/common/siano/smsdvb-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/common/siano/smsdvb-main.c +1 -1
index affde14..166428c 100644
@@ -271,7 +271,7 @@ static void smsdvb_update_per_slices(struct smsdvb_client_t *client,
 	c->post_bit_count.stat[0].uvalue += p->ber_bit_count;
 
 	/* Legacy PER/BER */
-	tmp = p->ets_packets * 65535;
+	tmp = p->ets_packets * 65535ULL;
 	if (p->ts_packets + p->ets_packets)
 		do_div(tmp, p->ts_packets + p->ets_packets);
 	client->legacy_per = tmp;
Signature · 1 line
2.7.4