diff mbox series

net: qrtr: fix len of skb_put_padto in qrtr_node_enqueue

Message ID 20191231093242.6320-1-wgong@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series net: qrtr: fix len of skb_put_padto in qrtr_node_enqueue | expand

Commit Message

Wen Gong Dec. 31, 2019, 9:32 a.m. UTC
From: Carl Huang <cjhuang@codeaurora.org>

The len used for skb_put_padto is wrong, it need to add len of hdr.

Signed-off-by: Carl Huang <cjhuang@codeaurora.org>
Signed-off-by: Wen Gong <wgong@codeaurora.org>
---
 net/qrtr/qrtr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Jan. 3, 2020, 12:22 a.m. UTC | #1
From: Wen Gong <wgong@codeaurora.org>
Date: Tue, 31 Dec 2019 17:32:42 +0800

> From: Carl Huang <cjhuang@codeaurora.org>
> 
> The len used for skb_put_padto is wrong, it need to add len of hdr.
> 
> Signed-off-by: Carl Huang <cjhuang@codeaurora.org>
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
 ...
> @@ -196,7 +196,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>  	hdr->size = cpu_to_le32(len);
>  	hdr->confirm_rx = 0;
>  
> -	skb_put_padto(skb, ALIGN(len, 4));
> +	skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));

I don't think this is correct.

The 'hdr' was already "pushed" earlier in this file.

Here we are padding the area after the header, which is being "put".

I'm not applying this.  If you still think it is correct, you must explain
in detail why it is and add that description to the commit log message.

Thank you.
Wen Gong Jan. 3, 2020, 1:37 a.m. UTC | #2
On 2020-01-03 08:22, David Miller wrote:

> I don't think this is correct.
> 
> The 'hdr' was already "pushed" earlier in this file.
> 
> Here we are padding the area after the header, which is being "put".
> 
> I'm not applying this.  If you still think it is correct, you must 
> explain
> in detail why it is and add that description to the commit log message.
> 
> Thank you.

Thanks David.
I will add more description and send patch v2.
Wen Gong Jan. 3, 2020, 4:52 a.m. UTC | #3
On 2020-01-03 09:37, Wen Gong wrote:
> On 2020-01-03 08:22, David Miller wrote:
> 
>> I don't think this is correct.
>> 
>> The 'hdr' was already "pushed" earlier in this file.
>> 
>> Here we are padding the area after the header, which is being "put".
>> 
>> I'm not applying this.  If you still think it is correct, you must 
>> explain
>> in detail why it is and add that description to the commit log 
>> message.
>> 
>> Thank you.
> 
> Thanks David.
> I will add more description and send patch v2.
v2:
http://patchwork.ozlabs.org/patch/1217201/
diff mbox series

Patch

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 88f98f27ad88..3d24d45be5f4 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -196,7 +196,7 @@  static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 	hdr->size = cpu_to_le32(len);
 	hdr->confirm_rx = 0;
 
-	skb_put_padto(skb, ALIGN(len, 4));
+	skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
 
 	mutex_lock(&node->ep_lock);
 	if (node->ep)