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

Commit 5bba87d6 authored by Yaniv Gardi's avatar Yaniv Gardi Committed by Matt Wagantall
Browse files

scsi: ufs: fix a bug where accessing an array in invalid index



Add range check on tag statistics array index to avoid a potential
situation where the array index is out-of-bounds in case
TS_NOT_SUPPORTED is returned as the index.

Change-Id: Ib35fd0abe9553f6ea259efd2f98c7a4ef490d6ed
Signed-off-by: default avatarYaniv Gardi <ygardi@codeaurora.org>
parent c1ffaa93
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ static void ufshcd_update_tag_stats(struct ufs_hba *hba, int tag)

	WARN_ON(hba->ufs_stats.q_depth > hba->nutrs);
	rq_type = ufshcd_tag_req_type(rq);
	if (!(rq_type < 0 || rq_type > TS_NUM_STATS))
		tag_stats[hba->ufs_stats.q_depth++][rq_type]++;
}