Commit 9fef8478 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

cxgb4: potential shift wrapping bug

"cntxt_id" is an unsigned int but "udb" is a u64 so there is a potential
shift wrapping bug here.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4567dc10
...@@ -2258,7 +2258,7 @@ static u64 udb_address(struct adapter *adap, unsigned int cntxt_id, ...@@ -2258,7 +2258,7 @@ static u64 udb_address(struct adapter *adap, unsigned int cntxt_id,
(QUEUESPERPAGEPF1 - QUEUESPERPAGEPF0) * adap->fn); (QUEUESPERPAGEPF1 - QUEUESPERPAGEPF0) * adap->fn);
udb_density = 1 << ((qpp >> s_qpp) & QUEUESPERPAGEPF0_MASK); udb_density = 1 << ((qpp >> s_qpp) & QUEUESPERPAGEPF0_MASK);
qpshift = PAGE_SHIFT - ilog2(udb_density); qpshift = PAGE_SHIFT - ilog2(udb_density);
udb = cntxt_id << qpshift; udb = (u64)cntxt_id << qpshift;
udb &= PAGE_MASK; udb &= PAGE_MASK;
page = udb / PAGE_SIZE; page = udb / PAGE_SIZE;
udb += (cntxt_id - (page * udb_density)) * SGE_UDB_SIZE; udb += (cntxt_id - (page * udb_density)) * SGE_UDB_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment