media: siano: fix a potential integer overflow
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 20 Sep 2017 01:09:18 +0000 (21:09 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 14 Dec 2017 14:50:12 +0000 (09:50 -0500)
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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/common/siano/smsdvb-main.c

index affde1426b7a21c11a905de62c4b5a9390ff0d5e..166428cbd3c88c7c3b2d5ea1a3d72a8d32a6e3b9 100644 (file)
@@ -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;