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

Commit cc9091dc authored by Shubhashree Dhar's avatar Shubhashree Dhar
Browse files

drm/msm: Add pointer check before dereference



Add pointer check, print error message and return
error value in case the pointer is NULL.

Change-Id: I9b776bfce771148606548a41cab6a695fc2adfa7
Signed-off-by: default avatarShubhashree Dhar <dhar@codeaurora.org>
parent d5546ff2
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1338,10 +1338,20 @@ static int dsi_message_rx(struct dsi_ctrl *dsi_ctrl,
	u32 current_read_len = 0, total_bytes_read = 0;
	bool short_resp = false;
	bool read_done = false;
	u32 dlen, diff, rlen = msg->rx_len;
	u32 dlen, diff, rlen;
	unsigned char *buff;
	char cmd;
	struct dsi_cmd_desc *of_cmd;

	if (!msg) {
		pr_err("Invalid msg\n");
		rc = -EINVAL;
		goto error;
	}

	of_cmd = container_of(msg, struct dsi_cmd_desc, msg);

	rlen = msg->rx_len;
	if (msg->rx_len <= 2) {
		short_resp = true;
		rd_pkt_size = msg->rx_len;
+14 −13
Original line number Diff line number Diff line
@@ -2664,13 +2664,14 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms)

	mutex_lock(&dev->mode_config.mutex);
	connector_list = &dev->mode_config.connector_list;
	if (connector_list) {
		list_for_each_entry(conn_iter, connector_list, head) {
			/**
			 * SDE_KMS doesn't attach more than one encoder to
		 * a DSI connector. So it is safe to check only with the
		 * first encoder entry. Revisit this logic if we ever have
		 * to support continuous splash for external displays in MST
		 * configuration.
			 * a DSI connector. So it is safe to check only with
			 * the first encoder entry. Revisit this logic if we
			 * ever have to support continuous splash for
			 * external displays in MST configuration.
			 */
			if (conn_iter &&
			  (conn_iter->encoder_ids[0] == encoder->base.id)) {
@@ -2678,7 +2679,7 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms)
				break;
			}
		}

	}
	if (!connector) {
		SDE_ERROR("connector not initialized\n");
		mutex_unlock(&dev->mode_config.mutex);