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

Commit 5f4e7588 authored by Brent Hronik's avatar Brent Hronik
Browse files

msm: smd: change bounds check on smd edges



Off-by-one array bounds checking could result in out-of-bounds array
access.

Correct array bounds checking.

CRs-Fixed: 561670
Change-Id: Ie20396444686a8ce203c2296ba7235514279f35d
Signed-off-by: default avatarBrent Hronik <bhronik@codeaurora.org>
parent 1937149f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3215,7 +3215,7 @@ int smd_edge_to_remote_pid(uint32_t edge)
 */
void smd_set_edge_subsys_name(uint32_t edge, const char *subsys_name)
{
	if (edge <= ARRAY_SIZE(edge_to_pids))
	if (edge < ARRAY_SIZE(edge_to_pids))
		strlcpy(edge_to_pids[edge].subsys_name,
			subsys_name, SMD_MAX_CH_NAME_LEN);
	else
@@ -3230,7 +3230,7 @@ void smd_set_edge_subsys_name(uint32_t edge, const char *subsys_name)
 */
void smd_set_edge_initialized(uint32_t edge)
{
	if (edge <= ARRAY_SIZE(edge_to_pids))
	if (edge < ARRAY_SIZE(edge_to_pids))
		edge_to_pids[edge].initialized = true;
	else
		pr_err("%s: Invalid edge type[%d]\n", __func__, edge);