vc4: Avoid overflowing various static tables.

This commit is contained in:
Eric Anholt
2015-07-29 14:40:10 -07:00
parent d0173bce37
commit 86541cf8ce
4 changed files with 4 additions and 4 deletions
@@ -487,7 +487,7 @@ vc4_validate_bin_cl(struct drm_device *dev,
u8 cmd = *(uint8_t *)src_pkt;
const struct cmd_info *info;
if (cmd > ARRAY_SIZE(cmd_info)) {
if (cmd >= ARRAY_SIZE(cmd_info)) {
DRM_ERROR("0x%08x: packet %d out of bounds\n",
src_offset, cmd);
return -EINVAL;
+1 -1
View File
@@ -397,7 +397,7 @@ vc4_dump_cl(void *cl, uint32_t size, bool is_render)
while (offset < size) {
uint8_t header = cmds[offset];
if (header > ARRAY_SIZE(packet_info) ||
if (header >= ARRAY_SIZE(packet_info) ||
!packet_info[header].name) {
fprintf(stderr, "0x%08x 0x%08x: Unknown packet 0x%02x (%d)!\n",
offset, hw_offset, header, header);
+1 -1
View File
@@ -108,7 +108,7 @@ static const struct vc4_format vc4_format_table[] = {
static const struct vc4_format *
get_format(enum pipe_format f)
{
if (f > ARRAY_SIZE(vc4_format_table) ||
if (f >= ARRAY_SIZE(vc4_format_table) ||
!vc4_format_table[f].present)
return NULL;
else
+1 -1
View File
@@ -225,7 +225,7 @@ static const char *qpu_condflags[] = {
};
#define DESC(array, index) \
((index > ARRAY_SIZE(array) || !(array)[index]) ? \
((index >= ARRAY_SIZE(array) || !(array)[index]) ? \
"???" : (array)[index])
static const char *