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

Commit eb2b1aa2 authored by Sravan Kumar D.V.N's avatar Sravan Kumar D.V.N Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: Fix potential deferencing of null pointer



While servicing display post processing ioctl for calib data the
driver checks if the calibration addr is valid. During this
check it deferences the base address for all pipes without
checking if the pipe pointer is NULL. This fix adds this check.

CRs-Fixed: 1082568

Change-Id: I4114d5491313b311c8907a91148be6606d0f4227
Signed-off-by: default avatarSravan Kumar D.V.N <sravank1@codeaurora.org>
parent bf10764e
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, 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
@@ -6804,9 +6804,6 @@ static int is_valid_calib_addr(void *addr, u32 operation)
	int ret = 0;
	char __iomem *ptr = addr;
	char __iomem *mixer_base = mdss_res->mixer_intf->base;
	char __iomem *rgb_base   = mdss_res->rgb_pipes->base;
	char __iomem *dma_base   = mdss_res->dma_pipes->base;
	char __iomem *vig_base   = mdss_res->vig_pipes->base;
	char __iomem *ctl_base   = mdss_res->ctl_off->base;
	char __iomem *dspp_base  = mdss_res->mixer_intf->dspp_base;

@@ -6838,17 +6835,20 @@ static int is_valid_calib_addr(void *addr, u32 operation)
			if (ret)
				goto valid_addr;
		}
		if (ptr >= vig_base) {
		if (mdss_res->vig_pipes &&
		  ptr >= mdss_res->vig_pipes->base) {
			ret = is_valid_calib_vig_addr(ptr);
			if (ret)
				goto valid_addr;
		}
		if (ptr >= rgb_base) {
		if (mdss_res->rgb_pipes &&
		  ptr >= mdss_res->rgb_pipes->base) {
			ret = is_valid_calib_rgb_addr(ptr);
			if (ret)
				goto valid_addr;
		}
		if (ptr >= dma_base) {
		if (mdss_res->dma_pipes &&
		  ptr >= mdss_res->dma_pipes->base) {
			ret = is_valid_calib_dma_addr(ptr);
			if (ret)
				goto valid_addr;