Commit d7874ce2 authored by Fuqian Huang's avatar Fuqian Huang Committed by liwei
Browse files

media: media/dvb: Use kmemdup rather than duplicating its implementation

mainline inclusion
from mainline-v5.4-rc1
commit f6af820e
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I635IG
CVE: CVE-2022-45884

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f6af820ef1be58c2e4b81aa479b9f109eb6344ce



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

kmemdup is introduced to duplicate a region of memory in a neat way.
Rather than kmalloc/kzalloc + memcpy, which the programmer needs to
write the size twice (sometimes lead to mistakes), kmemdup improves
readability, leads to smaller code and also reduce the chances of mistakes.
Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy.

Signed-off-by: default avatarFuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarliwei <liwei728@huawei.com>
parent caee0373
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment