diff options
| -rw-r--r-- | drivers/gpu/drm/drm_irq.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_bios.c | 27 | ||||
| -rw-r--r-- | include/drm/drmP.h | 2 |
3 files changed, 25 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index f9cc68fbd2a3..b50fa0afd907 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
| @@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600) | |||
| 75 | module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); | 75 | module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); |
| 76 | 76 | ||
| 77 | static void store_vblank(struct drm_device *dev, int crtc, | 77 | static void store_vblank(struct drm_device *dev, int crtc, |
| 78 | unsigned vblank_count_inc, | 78 | u32 vblank_count_inc, |
| 79 | struct timeval *t_vblank) | 79 | struct timeval *t_vblank) |
| 80 | { | 80 | { |
| 81 | struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; | 81 | struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 198fc3c3291b..3dcd59e694db 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
| @@ -1075,15 +1075,34 @@ parse_device_mapping(struct drm_i915_private *dev_priv, | |||
| 1075 | const union child_device_config *p_child; | 1075 | const union child_device_config *p_child; |
| 1076 | union child_device_config *child_dev_ptr; | 1076 | union child_device_config *child_dev_ptr; |
| 1077 | int i, child_device_num, count; | 1077 | int i, child_device_num, count; |
| 1078 | u16 block_size; | 1078 | u8 expected_size; |
| 1079 | u16 block_size; | ||
| 1079 | 1080 | ||
| 1080 | p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); | 1081 | p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); |
| 1081 | if (!p_defs) { | 1082 | if (!p_defs) { |
| 1082 | DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n"); | 1083 | DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n"); |
| 1083 | return; | 1084 | return; |
| 1084 | } | 1085 | } |
| 1085 | if (p_defs->child_dev_size < sizeof(*p_child)) { | 1086 | if (bdb->version < 195) { |
| 1086 | DRM_ERROR("General definiton block child device size is too small.\n"); | 1087 | expected_size = 33; |
| 1088 | } else if (bdb->version == 195) { | ||
| 1089 | expected_size = 37; | ||
| 1090 | } else if (bdb->version <= 197) { | ||
| 1091 | expected_size = 38; | ||
| 1092 | } else { | ||
| 1093 | expected_size = 38; | ||
| 1094 | DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n", | ||
| 1095 | expected_size, bdb->version); | ||
| 1096 | } | ||
| 1097 | |||
| 1098 | if (expected_size > sizeof(*p_child)) { | ||
| 1099 | DRM_ERROR("child_device_config cannot fit in p_child\n"); | ||
| 1100 | return; | ||
| 1101 | } | ||
| 1102 | |||
| 1103 | if (p_defs->child_dev_size != expected_size) { | ||
| 1104 | DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n", | ||
| 1105 | p_defs->child_dev_size, expected_size, bdb->version); | ||
| 1087 | return; | 1106 | return; |
| 1088 | } | 1107 | } |
| 1089 | /* get the block size of general definitions */ | 1108 | /* get the block size of general definitions */ |
| @@ -1130,7 +1149,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv, | |||
| 1130 | 1149 | ||
| 1131 | child_dev_ptr = dev_priv->vbt.child_dev + count; | 1150 | child_dev_ptr = dev_priv->vbt.child_dev + count; |
| 1132 | count++; | 1151 | count++; |
| 1133 | memcpy(child_dev_ptr, p_child, sizeof(*p_child)); | 1152 | memcpy(child_dev_ptr, p_child, p_defs->child_dev_size); |
| 1134 | } | 1153 | } |
| 1135 | return; | 1154 | return; |
| 1136 | } | 1155 | } |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 48db6a56975f..5aa519711e0b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -691,7 +691,7 @@ struct drm_vblank_crtc { | |||
| 691 | struct timer_list disable_timer; /* delayed disable timer */ | 691 | struct timer_list disable_timer; /* delayed disable timer */ |
| 692 | 692 | ||
| 693 | /* vblank counter, protected by dev->vblank_time_lock for writes */ | 693 | /* vblank counter, protected by dev->vblank_time_lock for writes */ |
| 694 | unsigned long count; | 694 | u32 count; |
| 695 | /* vblank timestamps, protected by dev->vblank_time_lock for writes */ | 695 | /* vblank timestamps, protected by dev->vblank_time_lock for writes */ |
| 696 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; | 696 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; |
| 697 | 697 | ||
