Skip to content

Commit e29b545

Browse files
Michael WernerDave Jones
authored andcommitted
[PATCH] sgi-agp: fixes a problem with accessing GART memory in sgi_tioca_insert_memory and sgi_tioca_remove_memory
This patch fixes a problem with accessing GART memory in sgi_tioca_insert_memory and sgi_tioca_remove_memory. sgi-agp.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Signed-off-by: Mike Werner <werner@sgi.com> Signed-off-by: Dave Jones <davej@redhat.com>
1 parent d0de98f commit e29b545

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/char/agp/sgi-agp.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,14 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
133133
off_t j;
134134
void *temp;
135135
struct agp_bridge_data *bridge;
136+
u64 *table;
136137

137138
bridge = mem->bridge;
138139
if (!bridge)
139140
return -EINVAL;
140141

142+
table = (u64 *)bridge->gatt_table;
143+
141144
temp = bridge->current_size;
142145

143146
switch (bridge->driver->size_type) {
@@ -175,7 +178,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
175178
j = pg_start;
176179

177180
while (j < (pg_start + mem->page_count)) {
178-
if (*(bridge->gatt_table + j))
181+
if (table[j])
179182
return -EBUSY;
180183
j++;
181184
}
@@ -186,7 +189,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
186189
}
187190

188191
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
189-
*(bridge->gatt_table + j) =
192+
table[j] =
190193
bridge->driver->mask_memory(bridge, mem->memory[i],
191194
mem->type);
192195
}
@@ -200,6 +203,7 @@ static int sgi_tioca_remove_memory(struct agp_memory *mem, off_t pg_start,
200203
{
201204
size_t i;
202205
struct agp_bridge_data *bridge;
206+
u64 *table;
203207

204208
bridge = mem->bridge;
205209
if (!bridge)
@@ -209,8 +213,10 @@ static int sgi_tioca_remove_memory(struct agp_memory *mem, off_t pg_start,
209213
return -EINVAL;
210214
}
211215

216+
table = (u64 *)bridge->gatt_table;
217+
212218
for (i = pg_start; i < (mem->page_count + pg_start); i++) {
213-
*(bridge->gatt_table + i) = 0;
219+
table[i] = 0;
214220
}
215221

216222
bridge->driver->tlb_flush(mem);

0 commit comments

Comments
 (0)