aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2012-04-04 19:10:35 -0400
committerDan Williams <dan.j.williams@intel.com>2012-04-05 18:22:58 -0400
commit21b764e075e74f8af90da9f623aa3e2167484687 (patch)
tree4ecbcdb82fdc3790d646bcd64b4cb5b481d1ad44 /drivers/dma/ioat
parent3d9ea9e3af048ab6b8dced15248384e548ba05ea (diff)
ioat: ring size variables need to be 32bit to avoid overflow
The alloc order can be up to 16 and 1 << 16 will over flow the 16bit integer. Change the appropriate variables to 16bit to avoid overflow. Reported-by: Jim Harris <james.r.harris@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ioat')
-rw-r--r--drivers/dma/ioat/dma_v2.c4
-rw-r--r--drivers/dma/ioat/dma_v2.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index cb8864d45601..143cb1b3cb26 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -575,9 +575,9 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order)
575 */ 575 */
576 struct ioat_chan_common *chan = &ioat->base; 576 struct ioat_chan_common *chan = &ioat->base;
577 struct dma_chan *c = &chan->common; 577 struct dma_chan *c = &chan->common;
578 const u16 curr_size = ioat2_ring_size(ioat); 578 const u32 curr_size = ioat2_ring_size(ioat);
579 const u16 active = ioat2_ring_active(ioat); 579 const u16 active = ioat2_ring_active(ioat);
580 const u16 new_size = 1 << order; 580 const u32 new_size = 1 << order;
581 struct ioat_ring_ent **ring; 581 struct ioat_ring_ent **ring;
582 u16 i; 582 u16 i;
583 583
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h
index a2c413b2b8d8..be2a55b95c23 100644
--- a/drivers/dma/ioat/dma_v2.h
+++ b/drivers/dma/ioat/dma_v2.h
@@ -74,7 +74,7 @@ static inline struct ioat2_dma_chan *to_ioat2_chan(struct dma_chan *c)
74 return container_of(chan, struct ioat2_dma_chan, base); 74 return container_of(chan, struct ioat2_dma_chan, base);
75} 75}
76 76
77static inline u16 ioat2_ring_size(struct ioat2_dma_chan *ioat) 77static inline u32 ioat2_ring_size(struct ioat2_dma_chan *ioat)
78{ 78{
79 return 1 << ioat->alloc_order; 79 return 1 << ioat->alloc_order;
80} 80}
@@ -91,7 +91,7 @@ static inline u16 ioat2_ring_pending(struct ioat2_dma_chan *ioat)
91 return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); 91 return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat));
92} 92}
93 93
94static inline u16 ioat2_ring_space(struct ioat2_dma_chan *ioat) 94static inline u32 ioat2_ring_space(struct ioat2_dma_chan *ioat)
95{ 95{
96 return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); 96 return ioat2_ring_size(ioat) - ioat2_ring_active(ioat);
97} 97}