cxgb4: potential shift wrapping bug
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 8 Oct 2014 13:43:17 +0000 (16:43 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Oct 2014 20:08:04 +0000 (16:08 -0400)
"cntxt_id" is an unsigned int but "udb" is a u64 so there is a potential
shift wrapping bug here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/sge.c

index bb7851e0b4c6431d3f3e18ebbf0bb9091ccf5a03..e8e90ce3ae159f4ffef0a77c37d7b1057d43574f 100644 (file)
@@ -2258,7 +2258,7 @@ static u64 udb_address(struct adapter *adap, unsigned int cntxt_id,
                (QUEUESPERPAGEPF1 - QUEUESPERPAGEPF0) * adap->fn);
        udb_density = 1 << ((qpp >> s_qpp) & QUEUESPERPAGEPF0_MASK);
        qpshift = PAGE_SHIFT - ilog2(udb_density);
-       udb = cntxt_id << qpshift;
+       udb = (u64)cntxt_id << qpshift;
        udb &= PAGE_MASK;
        page = udb / PAGE_SIZE;
        udb += (cntxt_id - (page * udb_density)) * SGE_UDB_SIZE;