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

Commit e6094ec8 authored by Vipin Deep Kaur's avatar Vipin Deep Kaur Committed by Gerrit - the friendly Code Review server
Browse files

i2c-msm-v2: Handle Null pointer de-reference



Zero message may be passed causing null pointer de-reference.
Adding check on the number of messages passed to handle the issue.

Change-Id: I7cef6dd2070c5eaaa748698c45540f8aa1d96116
Signed-off-by: default avatarVipin Deep Kaur <vkaur@codeaurora.org>
parent da61eb94
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2321,6 +2321,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) {
		dev_err(ctrl->dev,
		"error on number of msgs(%d) received\n", num);
		return -EINVAL;
	}

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