[PATCH] drm/i915/oprom: fix memdup.cocci warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: kernel test robot <lkp@xxxxxxxxx>

drivers/gpu/drm/i915/display/intel_bios.c:2274:7-14: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

CC: Anshuman Gupta <anshuman.gupta@xxxxxxxxx>
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: kernel test robot <lkp@xxxxxxxxx>
---

url:    https://github.com/0day-ci/linux/commits/Matthew-Auld/More-DG1-enabling/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 = (u8 *)oprom_opreg + found;
 	vbt_size = ((struct vbt_header *)parse_ptr)->vbt_size;
 
-	vbt = kzalloc(vbt_size, GFP_KERNEL);
+	vbt = 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;
 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux