Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abb0fdb2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: eeprom: Fix not enough memory buffer issue in EEPROM"

parents 75e48911 9e53de94
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -439,8 +439,8 @@ static int32_t cam_eeprom_parse_memory_map(
	else if (cmm_hdr->cmd_type == CAMERA_SENSOR_CMD_TYPE_WAIT)
		validate_size = sizeof(struct cam_cmd_unconditional_wait);

	if (remain_buf_len < validate_size ||
	    *num_map >= MSM_EEPROM_MAX_MEM_MAP_CNT) {
	if (remain_buf_len < validate_size || *num_map >=
		(MSM_EEPROM_MEMORY_MAP_MAX_SIZE * MSM_EEPROM_MAX_MEM_MAP_CNT)) {
		CAM_ERR(CAM_EEPROM, "not enough buffer");
		return -EINVAL;
	}
@@ -449,7 +449,9 @@ static int32_t cam_eeprom_parse_memory_map(
		i2c_random_wr = (struct cam_cmd_i2c_random_wr *)cmd_buf;

		if (i2c_random_wr->header.count == 0 ||
		    i2c_random_wr->header.count >= MSM_EEPROM_MAX_MEM_MAP_CNT ||
			i2c_random_wr->header.count >=
			(MSM_EEPROM_MEMORY_MAP_MAX_SIZE *
			MSM_EEPROM_MAX_MEM_MAP_CNT) ||
		    (size_t)*num_map > U16_MAX - i2c_random_wr->header.count) {
			CAM_ERR(CAM_EEPROM, "OOB Error");
			return -EINVAL;