Content-Type: multipart/mixed; boundary="===============4275044824980645727==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: [PATCH] drm/i915/oprom: fix memdup.cocci warnings Date: Tue, 13 Apr 2021 06:36:31 +0800 Message-ID: <20210412223630.GA13421@638f114fa1d0> In-Reply-To: <20210412090526.30547-15-matthew.auld@intel.com> List-Id: --===============4275044824980645727== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: kernel test robot drivers/gpu/drm/i915/display/intel_bios.c:2274:7-14: WARNING opportunity fo= r kmemdup Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci CC: Anshuman Gupta Reported-by: kernel test robot Signed-off-by: kernel test robot --- url: https://github.com/0day-ci/linux/commits/Matthew-Auld/More-DG1-enab= ling/20210412-171139 base: git://anongit.freedesktop.org/drm-intel for-linux-next intel_bios.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -2271,14 +2271,13 @@ static struct vbt_header *spi_oprom_get_ parse_ptr =3D (u8 *)oprom_opreg + found; vbt_size =3D ((struct vbt_header *)parse_ptr)->vbt_size; = - vbt =3D kzalloc(vbt_size, GFP_KERNEL); + vbt =3D kmemdup(parse_ptr, vbt_size, GFP_KERNEL); if (!vbt) { DRM_ERROR("Unable to allocate %u bytes for VBT storage\n", vbt_size); goto err_not_found; } = - memcpy(vbt, parse_ptr, vbt_size); if (!intel_bios_is_valid_vbt(vbt, vbt_size)) goto err_free_vbt; =20 --===============4275044824980645727==--