Re: [PATCH v3 net-next 08/21] net: usb: aqc111: Implement TX data path

From: David Miller <davem@davemloft.net>
Date: 2018-11-22 19:07:41
Also in: linux-usb

From: Igor Russkikh <redacted>
Date: Wed, 21 Nov 2018 10:13:37 +0000
+	if (padding_size != 0)
+		skb_put(skb, padding_size);
I think you want to use skb_put_zero() here rather than leaving it
uninitialized.  I know it's padding, but if for some reason this leaks
onto the wire or elsewhere we'll regret not initializing this buffer.
+	/* Copy TX header */
+	skb_push(skb, sizeof(tx_desc));
+	cpu_to_le64s(&tx_desc);
+	skb_copy_to_linear_data(skb, &tx_desc, sizeof(tx_desc));
I seriously wonder if, with all of the invariants wrt. length modulus
and padding, that you can safely just go:

	__le64 *p;

	p = skb_push(skb, sizeof(tx_desc));
	*p = cpu_to_le64(tx_desc);

or something like that.
	
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help