drivers/gpu/drm/radeon/radeon_atombios.c: 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. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
8c88e50bcf
commit
0031c41be5
|
@ -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_INFO
|
||||
|
|
|
@ -1264,7 +1264,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);
|
||||
|
@ -1302,7 +1302,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];
|
||||
|
|
Loading…
Reference in New Issue