radeon: range check issues
Subsystems (2)
PATCH 1/1 radeon: range check issues
This change makes the array larger, "MAX_SUPPORTED_TV_TIMING_V1_2" is 3 and the original size "MAX_SUPPORTED_TV_TIMING" is 2.
Also there were checks that were off by one.
---
Compile tested only. Changing the array size seemed like the right thing to do, in the context, but please review carefully.
drivers/gpu/drm/radeon/atombios.h +1 -1
@@ -2912,7 +2912,7 @@ typedef struct _ATOM_ANALOG_TV_INFO_V1_2UCHAR ucTV_BootUpDefaultStandard;UCHAR ucExt_TV_ASIC_ID;UCHAR ucExt_TV_ASIC_SlaveAddr; -ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING ]; +ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING_V1_2 ]; }ATOM_ANALOG_TV_INFO_V1_2 ; typedef struct _ATOM_DPCD_INFO
drivers/gpu/drm/radeon/radeon_atombios.c +2 -2
@@ -1275,7 +1275,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,switch (crev) {case 1 : tv_info = (ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset); -if (index >MAX_SUPPORTED_TV_TIMING ) +if (index >=MAX_SUPPORTED_TV_TIMING )return false; mode->crtc_htotal =le16_to_cpu (tv_info->aModeTimings[index].usCRTC_H_Total);
@@ -1313,7 +1313,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,break ;case 2 : tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2 *)(mode_info->atom_context->bios + data_offset); -if (index >MAX_SUPPORTED_TV_TIMING_V1_2 ) +if (index >=MAX_SUPPORTED_TV_TIMING_V1_2 )return false; dtd_timings = &tv_info_v1_2->aModeTimings[index];
Quoted 9 lines · Dan Carpenter
This change makes the array larger, "
MAX_SUPPORTED_TV_TIMING_V1_2" is 3 and the original size "MAX_SUPPORTED_TV_TIMING" is 2.Also there were checks that were off by one.
Signed-off-by Dan Carpenter <[email protected]>---
Compile tested only. Changing the array size seemed like the right thing to do, in the context, but please review carefully.
That patch is correct and corresponds to the actual table sizes in the vbios.
Alex
Quoted 35 lines
drivers/gpu/drm/radeon/atombios.h +1
-1@@ -2912,7 +2912,7 @@ typedef struct _ATOM_ANALOG_TV_INFO_V1_2 UCHAR ucTV_BootUpDefaultStandard; UCHAR ucExt_TV_ASIC_ID; UCHAR ucExt_TV_ASIC_SlaveAddr; - ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING]; + ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING_V1_2]; }ATOM_ANALOG_TV_INFO_V1_2;typedef struct
_ATOM_DPCD_INFOdrivers/gpu/drm/radeon/radeon_atombios.c +0
-0@@ -1275,7 +1275,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, switch (crev) {case 1:
tv_info = (ATOM_ANALOG_TV_INFO*)(mode_info->atom_context->bios +data_offset);
- if (index >MAX_SUPPORTED_TV_TIMING)
+ if (index >=MAX_SUPPORTED_TV_TIMING)
return false;mode->crtc_htotal =
le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total);drivers/gpu/drm/radeon/radeon_atombios.c +0
-0@@ -1313,7 +1313,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, break;case 2:
tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2*)(mode_info->atom_context->bios +data_offset);
- if (index >MAX_SUPPORTED_TV_TIMING_V1_2)
+ if (index >=MAX_SUPPORTED_TV_TIMING_V1_2)
return false;
Quoted 3 lines
dtd_timings = &tv_info_v1_2->aModeTimings[index];
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
Quoted 9 lines · Dan Carpenter
This change makes the array larger, "
MAX_SUPPORTED_TV_TIMING_V1_2" is 3 and the original size "MAX_SUPPORTED_TV_TIMING" is 2.Also there were checks that were off by one.
Signed-off-by Dan Carpenter <[email protected]>---
Compile tested only. Changing the array size seemed like the right thing to do, in the context, but please review carefully.
That patch is correct and corresponds to the actual table sizes in the vbios.
Alex
Quoted 38 lines
drivers/gpu/drm/radeon/atombios.h +1
-1@@ -2912,7 +2912,7 @@ typedef struct _ATOM_ANALOG_TV_INFO_V1_2 UCHAR ucTV_BootUpDefaultStandard; UCHAR ucExt_TV_ASIC_ID; UCHAR ucExt_TV_ASIC_SlaveAddr; - ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING]; + ATOM_DTD_FORMAT aModeTimings[MAX_SUPPORTED_TV_TIMING_V1_2]; }ATOM_ANALOG_TV_INFO_V1_2;typedef struct
_ATOM_DPCD_INFOdrivers/gpu/drm/radeon/radeon_atombios.c +0
-0@@ -1275,7 +1275,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, switch (crev) {case 1:
tv_info = (ATOM_ANALOG_TV_INFO*)(mode_info->atom_context->bios +data_offset);
- if (index >MAX_SUPPORTED_TV_TIMING)
+ if (index >=MAX_SUPPORTED_TV_TIMING)
return false;mode->crtc_htotal =
le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total);drivers/gpu/drm/radeon/radeon_atombios.c +0
-0@@ -1313,7 +1313,7 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, break;case 2:
tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2*)(mode_info->atom_context->bios +data_offset);
- if (index >MAX_SUPPORTED_TV_TIMING_V1_2)
+ if (index >=MAX_SUPPORTED_TV_TIMING_V1_2)
return false;dtd_timings = &tv_info_v1_2->aModeTimings[index];