diff options
author | Dan Williams <dan.j.williams@intel.com> | 2013-11-13 13:15:42 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2013-11-14 14:04:41 -0500 |
commit | 5d48b9b5d80e3aa38a5161565398b1e48a650573 (patch) | |
tree | 8f0f05bdae0c7c676f327c33c173384cdd64c11c | |
parent | ac7d631f7d9f9e4e6116c4a72b6308067d0a2226 (diff) |
ioatdma: fix sed pool selection
The array to lookup the sed pool based on the number of sources
(pq16_idx_to_sedi) is 16 entries and expects a max source index.
However, we pass the total source count which runs off the end of the
array when src_cnt == 16. The minimal fix is to just pass src_cnt-1,
but given we know the source count is > 8 we can just calculate the sed
pool by (src_cnt - 2) >> 3.
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: <stable@vger.kernel.org>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/dma/ioat/dma_v3.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 44786ad2a4cf..f26a35d43ba1 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -87,13 +87,6 @@ static const u8 pq_idx_to_field[] = { 1, 4, 5, 0, 1, 2, 4, 5 }; | |||
87 | static const u8 pq16_idx_to_field[] = { 1, 4, 1, 2, 3, 4, 5, 6, 7, | 87 | static const u8 pq16_idx_to_field[] = { 1, 4, 1, 2, 3, 4, 5, 6, 7, |
88 | 0, 1, 2, 3, 4, 5, 6 }; | 88 | 0, 1, 2, 3, 4, 5, 6 }; |
89 | 89 | ||
90 | /* | ||
91 | * technically sources 1 and 2 do not require SED, but the op will have | ||
92 | * at least 9 descriptors so that's irrelevant. | ||
93 | */ | ||
94 | static const u8 pq16_idx_to_sed[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
95 | 1, 1, 1, 1, 1, 1, 1 }; | ||
96 | |||
97 | static void ioat3_eh(struct ioat2_dma_chan *ioat); | 90 | static void ioat3_eh(struct ioat2_dma_chan *ioat); |
98 | 91 | ||
99 | static void xor_set_src(struct ioat_raw_descriptor *descs[2], | 92 | static void xor_set_src(struct ioat_raw_descriptor *descs[2], |
@@ -128,12 +121,6 @@ static void pq_set_src(struct ioat_raw_descriptor *descs[2], | |||
128 | pq->coef[idx] = coef; | 121 | pq->coef[idx] = coef; |
129 | } | 122 | } |
130 | 123 | ||
131 | static int sed_get_pq16_pool_idx(int src_cnt) | ||
132 | { | ||
133 | |||
134 | return pq16_idx_to_sed[src_cnt]; | ||
135 | } | ||
136 | |||
137 | static bool is_jf_ioat(struct pci_dev *pdev) | 124 | static bool is_jf_ioat(struct pci_dev *pdev) |
138 | { | 125 | { |
139 | switch (pdev->device) { | 126 | switch (pdev->device) { |
@@ -994,8 +981,7 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, | |||
994 | 981 | ||
995 | descs[0] = (struct ioat_raw_descriptor *) pq; | 982 | descs[0] = (struct ioat_raw_descriptor *) pq; |
996 | 983 | ||
997 | desc->sed = ioat3_alloc_sed(device, | 984 | desc->sed = ioat3_alloc_sed(device, (src_cnt-2) >> 3); |
998 | sed_get_pq16_pool_idx(src_cnt)); | ||
999 | if (!desc->sed) { | 985 | if (!desc->sed) { |
1000 | dev_err(to_dev(chan), | 986 | dev_err(to_dev(chan), |
1001 | "%s: no free sed entries\n", __func__); | 987 | "%s: no free sed entries\n", __func__); |