From: Namjae Jeon namjae.jeon@samsung.com
mainline inclusion from mainline-5.15-rc1 commit 3566a2b0f73a46eb93beafd70b8386a3b59d5acb category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA
Reference: https://git.kernel.org/torvalds/linux/c/3566a2b0f73a
-------------------------------
Use memcmp instead of for loop check in oid_eq().
Reviewed-by: Dan Carpenter dan.carpenter@oracle.com Signed-off-by: Namjae Jeon namjae.jeon@samsung.com Signed-off-by: Steve French stfrench@microsoft.com Signed-off-by: Jason Yan yanaijie@huawei.com Signed-off-by: Zhong Jinghua zhongjinghua@huawei.com --- fs/cifsd/asn1.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/fs/cifsd/asn1.c b/fs/cifsd/asn1.c index f2628dc3490f..a7db37eef2a9 100644 --- a/fs/cifsd/asn1.c +++ b/fs/cifsd/asn1.c @@ -110,16 +110,10 @@ static bool oid_eq(unsigned long *oid1, unsigned int oid1len, unsigned long *oid2, unsigned int oid2len) { - unsigned int i; - if (oid1len != oid2len) return false;
- for (i = 0; i < oid1len; i++) { - if (oid1[i] != oid2[i]) - return false; - } - return true; + return memcmp(oid1, oid2, oid1len) == 0; }
int