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

Commit af7449cf authored by Alok Chauhan's avatar Alok Chauhan
Browse files

msm: msm_bus: Fix the type error causing bandwidth overflow



On legacy chipsets, long int was being used to store
return value after calculating interleaved bw. However,
NoCs support 64-bit integers ab/ib values. problme occurs
if client request for higher bw and if difference of ab
value exceeds the range of 32 bit integer, the Value
overflows and turns negative, which leads to wrong bw calculation.

This patch fixes this integer overflow by correcting argument
type to store bw.

CRs-Fixed: 537213
Change-Id: I8c6c79ba245a988c2c54ccaca3f3eaf5cb857ce5
Signed-off-by: default avatarAlok Chauhan <alokc@codeaurora.org>
parent 568a7d3d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1876,7 +1876,7 @@ static void msm_bus_bimc_update_bw(struct msm_bus_inode_info *hop,
	struct msm_bus_bimc_info *binfo;
	struct msm_bus_bimc_qos_bw qbw;
	int i;
	long int bw;
	int64_t bw;
	int ports = info->node_info->num_mports;
	struct msm_bus_bimc_commit *sel_cd =
		(struct msm_bus_bimc_commit *)sel_cdata;
@@ -1912,11 +1912,11 @@ static void msm_bus_bimc_update_bw(struct msm_bus_inode_info *hop,
			qbw.bw = sel_cd->mas[info->node_info->masterp[i]].bw;
			qbw.ws = info->node_info->ws;
			/* Threshold low = 90% of bw */
			qbw.thl = (90 * bw) / 100;
			qbw.thl = div_s64((90 * bw), 100);
			/* Threshold medium = bw */
			qbw.thm = bw;
			/* Threshold high = 10% more than bw */
			qbw.thh = (110 * bw) / 100;
			qbw.thh = div_s64((110 * bw), 100);
			/* Check if info is a shared master.
			 * If it is, mark it dirty
			 * If it isn't, then set QOS Bandwidth
+1 −1
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ static void msm_bus_noc_update_bw(struct msm_bus_inode_info *hop,
	struct msm_bus_noc_info *ninfo;
	struct msm_bus_noc_qos_bw qos_bw;
	int i, ports;
	long int bw;
	int64_t bw;
	struct msm_bus_noc_commit *sel_cd =
		(struct msm_bus_noc_commit *)sel_cdata;