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

Commit 2c5c1a1b authored by Viswanadha Raju Thotakura's avatar Viswanadha Raju Thotakura
Browse files

msm: camera: Handle out of bound cases properly



In the case of seq_type, check whether the data from user
is within the bounds.

Change-Id: Ic85227c7a4fd0aabf3fffd19a79d595811a88eb2
Signed-off-by: default avatarViswanadha Raju Thotakura <viswanad@codeaurora.org>
parent a32fc7b4
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -340,6 +340,14 @@ int32_t msm_camera_fill_vreg_params(
	}

	for (i = 0; i < power_setting_size; i++) {

		if (power_setting[i].seq_type < SENSOR_MCLK ||
			power_setting[i].seq_type >= SENSOR_SEQ_TYPE_MAX) {
			CAM_ERR(CAM_SENSOR, "failed: Invalid Seq type\n",
				power_setting[i].seq_type);
			return -EINVAL;
		}

		switch (power_setting[i].seq_type) {
		case SENSOR_VDIG:
			for (j = 0; j < num_vreg; j++) {
@@ -488,14 +496,10 @@ int32_t msm_camera_fill_vreg_params(
			if (j == num_vreg)
				power_setting[i].seq_val = INVALID_VREG;
			break;

		default: {
			CAM_ERR(CAM_SENSOR, "invalid seq_val %d",
				power_setting[i].seq_val);
		default:
			break;
		}
	}
	}

	return rc;
}