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

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

Merge "i2c-msm-v2: Add NULL pointer check on i2c messages"

parents fff8b137 fecef602
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2144,8 +2144,12 @@ static bool i2c_msm_xfer_next_buf(struct i2c_msm_ctrl *ctrl)
{
	struct i2c_msm_xfer_buf *cur_buf = &ctrl->xfer.cur_buf;
	struct i2c_msg          *cur_msg = ctrl->xfer.msgs + cur_buf->msg_idx;
	int bc_rem = cur_msg->len - cur_buf->end_idx;
	int bc_rem = 0;

	if (!cur_msg)
		return false;

	bc_rem = cur_msg->len - cur_buf->end_idx;
	if (cur_buf->is_init && cur_buf->end_idx && bc_rem) {
		/* not the first buffer in a message */

@@ -2321,17 +2325,12 @@ i2c_msm_frmwrk_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
	struct i2c_msm_ctrl      *ctrl = i2c_get_adapdata(adap);
	struct i2c_msm_xfer      *xfer = &ctrl->xfer;

	if (num < 1) {
	if (IS_ERR_OR_NULL(msgs) || num < 1) {
		dev_err(ctrl->dev,
		"error on number of msgs(%d) received\n", num);
		"Error on msgs Accessing invalid message pointer or message buffer\n");
		return -EINVAL;
	}

	if (IS_ERR_OR_NULL(msgs)) {
		dev_err(ctrl->dev, " error on msgs Accessing invalid  pointer location\n");
		return PTR_ERR(msgs);
	}

	/* if system is suspended just bail out */
	if (ctrl->pwr_state == I2C_MSM_PM_SYS_SUSPENDED) {
		dev_err(ctrl->dev,