diff options
| -rw-r--r-- | drivers/char/agp/uninorth-agp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 03f95ec08f59..880d3f6d5b98 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
| @@ -146,13 +146,20 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, | |||
| 146 | { | 146 | { |
| 147 | int i, j, num_entries; | 147 | int i, j, num_entries; |
| 148 | void *temp; | 148 | void *temp; |
| 149 | int mask_type; | ||
| 149 | 150 | ||
| 150 | temp = agp_bridge->current_size; | 151 | temp = agp_bridge->current_size; |
| 151 | num_entries = A_SIZE_32(temp)->num_entries; | 152 | num_entries = A_SIZE_32(temp)->num_entries; |
| 152 | 153 | ||
| 153 | if (type != 0 || mem->type != 0) | 154 | if (type != mem->type) |
| 155 | return -EINVAL; | ||
| 156 | |||
| 157 | mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type); | ||
| 158 | if (mask_type != 0) { | ||
| 154 | /* We know nothing of memory types */ | 159 | /* We know nothing of memory types */ |
| 155 | return -EINVAL; | 160 | return -EINVAL; |
| 161 | } | ||
| 162 | |||
| 156 | if ((pg_start + mem->page_count) > num_entries) | 163 | if ((pg_start + mem->page_count) > num_entries) |
| 157 | return -EINVAL; | 164 | return -EINVAL; |
| 158 | 165 | ||
| @@ -184,13 +191,20 @@ static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
| 184 | int i, num_entries; | 191 | int i, num_entries; |
| 185 | void *temp; | 192 | void *temp; |
| 186 | u32 *gp; | 193 | u32 *gp; |
| 194 | int mask_type; | ||
| 187 | 195 | ||
| 188 | temp = agp_bridge->current_size; | 196 | temp = agp_bridge->current_size; |
| 189 | num_entries = A_SIZE_32(temp)->num_entries; | 197 | num_entries = A_SIZE_32(temp)->num_entries; |
| 190 | 198 | ||
| 191 | if (type != 0 || mem->type != 0) | 199 | if (type != mem->type) |
| 200 | return -EINVAL; | ||
| 201 | |||
| 202 | mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type); | ||
| 203 | if (mask_type != 0) { | ||
| 192 | /* We know nothing of memory types */ | 204 | /* We know nothing of memory types */ |
| 193 | return -EINVAL; | 205 | return -EINVAL; |
| 206 | } | ||
| 207 | |||
| 194 | if ((pg_start + mem->page_count) > num_entries) | 208 | if ((pg_start + mem->page_count) > num_entries) |
| 195 | return -EINVAL; | 209 | return -EINVAL; |
| 196 | 210 | ||
