Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4438f03 authored by Benoit Taine's avatar Benoit Taine Committed by David S. Miller
Browse files

r8152: Use kmemdup instead of kmalloc + memcpy



This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci

Signed-off-by: default avatarBenoit Taine <benoit.taine@lip6.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 958c492c
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -630,12 +630,10 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
	int ret;
	void *tmp;

	tmp = kmalloc(size, GFP_KERNEL);
	tmp = kmemdup(data, size, GFP_KERNEL);
	if (!tmp)
		return -ENOMEM;

	memcpy(tmp, data, size);

	ret = usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0),
			       RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE,
			       value, index, tmp, size, 500);