|
@@ -167,6 +167,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
|
|
|
{
|
|
|
int err = 0;
|
|
|
mtrr_type type;
|
|
|
+ unsigned long base;
|
|
|
unsigned long size;
|
|
|
struct mtrr_sentry sentry;
|
|
|
struct mtrr_gentry gentry;
|
|
@@ -267,14 +268,14 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
|
|
|
#endif
|
|
|
if (gentry.regnum >= num_var_ranges)
|
|
|
return -EINVAL;
|
|
|
- mtrr_if->get(gentry.regnum, &gentry.base, &size, &type);
|
|
|
+ mtrr_if->get(gentry.regnum, &base, &size, &type);
|
|
|
|
|
|
/* Hide entries that go above 4GB */
|
|
|
- if (gentry.base + size - 1 >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT))
|
|
|
+ if (base + size - 1 >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT))
|
|
|
|| size >= (1UL << (8 * sizeof(gentry.size) - PAGE_SHIFT)))
|
|
|
gentry.base = gentry.size = gentry.type = 0;
|
|
|
else {
|
|
|
- gentry.base <<= PAGE_SHIFT;
|
|
|
+ gentry.base = base << PAGE_SHIFT;
|
|
|
gentry.size = size << PAGE_SHIFT;
|
|
|
gentry.type = type;
|
|
|
}
|
|
@@ -321,11 +322,12 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
|
|
|
#endif
|
|
|
if (gentry.regnum >= num_var_ranges)
|
|
|
return -EINVAL;
|
|
|
- mtrr_if->get(gentry.regnum, &gentry.base, &size, &type);
|
|
|
+ mtrr_if->get(gentry.regnum, &base, &size, &type);
|
|
|
/* Hide entries that would overflow */
|
|
|
if (size != (__typeof__(gentry.size))size)
|
|
|
gentry.base = gentry.size = gentry.type = 0;
|
|
|
else {
|
|
|
+ gentry.base = base;
|
|
|
gentry.size = size;
|
|
|
gentry.type = type;
|
|
|
}
|