2019-08-25 20:59:57

by Ivan Safonov

[permalink] [raw]
Subject: [PATCH] r8188eu: use skb_put_data instead of skb_put/memcpy pair

skb_put_data is shorter and clear.

Signed-off-by: Ivan Safonov <[email protected]>
---
drivers/staging/rtl8188eu/core/rtw_recv.c | 6 +-----
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 3 +--
2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 620da6c003d8..d4278361e002 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -1373,11 +1373,7 @@ static struct recv_frame *recvframe_defrag(struct
adapter *adapter,
/* append to first fragment frame's tail (if privacy
frame, pull the ICV) */
skb_trim(prframe->pkt, prframe->pkt->len -
prframe->attrib.icv_len);

- /* memcpy */
- memcpy(skb_tail_pointer(prframe->pkt), pnfhdr->pkt->data,
- pnfhdr->pkt->len);
-
- skb_put(prframe->pkt, pnfhdr->pkt->len);
+ skb_put_data(prframe->pkt, pnfhdr->pkt->data,
pnfhdr->pkt->len);

prframe->attrib.icv_len = pnfhdr->attrib.icv_len;
plist = plist->next;
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index eedf2cd831d1..aaab0d577453 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -122,8 +122,7 @@ static int recvbuf2recvframe(struct adapter *adapt,
struct sk_buff *pskb)
precvframe->pkt = pkt_copy;
skb_reserve(pkt_copy, 8 -
((size_t)(pkt_copy->data) & 7));/* force pkt_copy->data at 8-byte
alignment address */
skb_reserve(pkt_copy, shift_sz);/* force ip_hdr
at 8-byte alignment address according to shift_sz. */
- memcpy(pkt_copy->data, (pbuf +
pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
- skb_put(precvframe->pkt, skb_len);
+ skb_put_data(pkt_copy, (pbuf +
pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
} else {
DBG_88E("%s: alloc_skb fail , drop frag frame\n",
__func__);
--
2.21.0


2019-08-27 10:34:27

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] r8188eu: use skb_put_data instead of skb_put/memcpy pair

On Sun, Aug 25, 2019 at 11:48:58PM +0300, Ivan Safonov wrote:
> skb_put_data is shorter and clear.
>

Please don't start the commit message in the middle of a sentence. It
often gets split from the start of the sentence. See how it looks here.
https://marc.info/?l=linux-driver-devel&m=156676594611401&w=2


> Signed-off-by: Ivan Safonov <[email protected]>
> ---
> drivers/staging/rtl8188eu/core/rtw_recv.c | 6 +-----
> drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 3 +--
> 2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c
> b/drivers/staging/rtl8188eu/core/rtw_recv.c
> index 620da6c003d8..d4278361e002 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_recv.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
> @@ -1373,11 +1373,7 @@ static struct recv_frame *recvframe_defrag(struct
> adapter *adapter,
> /* append to first fragment frame's tail (if privacy frame,
> pull the ICV) */
> skb_trim(prframe->pkt, prframe->pkt->len -
> prframe->attrib.icv_len);


Your email client corrupted the patch so it can't be applied.

regards,
dan carpenter

2019-08-31 17:29:15

by Ivan Safonov

[permalink] [raw]
Subject: Re: [PATCH] r8188eu: use skb_put_data instead of skb_put/memcpy pair

On 8/27/19 1:31 PM, Dan Carpenter wrote:
> On Sun, Aug 25, 2019 at 11:48:58PM +0300, Ivan Safonov wrote:
>> skb_put_data is shorter and clear.
>>
>
> Please don't start the commit message in the middle of a sentence. It
> often gets split from the start of the sentence. See how it looks here.
> https://marc.info/?l=linux-driver-devel&m=156676594611401&w=2
>
>
>> Signed-off-by: Ivan Safonov <[email protected]>
>> ---
>> drivers/staging/rtl8188eu/core/rtw_recv.c | 6 +-----
>> drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 3 +--
>> 2 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c
>> b/drivers/staging/rtl8188eu/core/rtw_recv.c
>> index 620da6c003d8..d4278361e002 100644
>> --- a/drivers/staging/rtl8188eu/core/rtw_recv.c
>> +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
>> @@ -1373,11 +1373,7 @@ static struct recv_frame *recvframe_defrag(struct
>> adapter *adapter,
>> /* append to first fragment frame's tail (if privacy frame,
>> pull the ICV) */
>> skb_trim(prframe->pkt, prframe->pkt->len -
>> prframe->attrib.icv_len);
>
>
> Your email client corrupted the patch so it can't be applied.

Thanks, Dan.
>
> regards,
> dan carpenter
>