Commit c97feda2 authored by niuyongwen's avatar niuyongwen Committed by xiongmengbiao
Browse files

drivers/crypto/ccp: memmove is used instead of memcpy in overlapped memmory for tkm

hygon inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9C3AM


CVE: NA

---------------------------

When deleting a VID, `memcpy` is used to move
data within the array and overwrite the deleted VID entry.

However, `memcpy` does not handle overlapping
memory regions correctly within the array.

Therefore, `memmove` should be used instead.

Signed-off-by: default avatarniuyongwen <niuyongwen@hygon.cn>
parent a05a98fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static int vpsp_del_vid(void)
			--g_vpsp_vid_num;
			pr_info("PSP: delete vid %d, by pid %d, total vid num is %d\n",
				g_vpsp_vid_array[i].vid, cur_pid, g_vpsp_vid_num);
			memcpy(&g_vpsp_vid_array[i], &g_vpsp_vid_array[i + 1],
			memmove(&g_vpsp_vid_array[i], &g_vpsp_vid_array[i + 1],
				sizeof(struct vpsp_vid_entry) * (g_vpsp_vid_num - i));
			ret = 0;
			goto end;