msm: camera: sensor: Add null check for read buffer

Add proper null checks for function arguments,
including read buffer, before dereferencing them.

CRs-Fixed: 2581538
Change-Id: I8c49bbc419e2ac5579341c7dc789da0ed1c4d123
Signed-off-by: Shravan Nevatia <snevatia@codeaurora.org>
This commit is contained in:
Shravan Nevatia 2019-12-03 21:39:28 +05:30 • committed by Gerrit - the friendly Code Review server
commit 9fdce6ca87

View file

@ -241,6 +241,12 @@ static int32_t cam_sensor_get_io_buffer(
size_t buf_size = 0;
int32_t rc = 0;
if (io_cfg == NULL || i2c_settings == NULL) {
CAM_ERR(CAM_SENSOR,
"Invalid args, io buf or i2c settings is NULL");
return -EINVAL;
}
if (io_cfg->direction == CAM_BUF_OUTPUT) {
rc = cam_mem_get_cpu_buf(io_cfg->mem_handle[0],
&buf_addr, &buf_size);