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

Commit fbb9d05d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: socinfo: Fix array out-of-bounds access"

parents a911709e ba4aef73
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -1163,6 +1163,18 @@ static void socinfo_print(void)
	}
}

static const char *socinfo_machine(unsigned int id)
{
	int idx;

	for (idx = 0; idx < ARRAY_SIZE(soc_id); idx++) {
		if (soc_id[idx].id == id)
			return soc_id[idx].name;
	}

	return NULL;
}

uint32_t socinfo_get_id(void)
{
	return (socinfo) ? le32_to_cpu(socinfo->id) : 0;
@@ -1173,22 +1185,10 @@ const char *socinfo_get_id_string(void)
{
	uint32_t id = socinfo_get_id();

	return (socinfo) ? soc_id[id].name : NULL;
	return socinfo_machine(id);
}
EXPORT_SYMBOL(socinfo_get_id_string);

static const char *socinfo_machine(unsigned int id)
{
	int idx;

	for (idx = 0; idx < ARRAY_SIZE(soc_id); idx++) {
		if (soc_id[idx].id == id)
			return soc_id[idx].name;
	}

	return NULL;
}

static int qcom_socinfo_probe(struct platform_device *pdev)
{
	struct qcom_socinfo *qs;