From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D294C49ED7 for ; Sat, 21 Sep 2019 11:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A670208C0 for ; Sat, 21 Sep 2019 11:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407583AbfIULwx (ORCPT ); Sat, 21 Sep 2019 07:52:53 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:59247 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405770AbfIULwx (ORCPT ); Sat, 21 Sep 2019 07:52:53 -0400 Received: from localhost.localdomain (unknown [IPv6:2003:e9:d742:d2ca:2f74:a255:7f82:cac1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@datenfreihafen.org) by proxima.lasnet.de (Postfix) with ESMTPSA id 5EE4AC18BE; Sat, 21 Sep 2019 13:52:48 +0200 (CEST) Subject: Re: [PATCH] ieee802154: mcr20a: simplify a bit 'mcr20a_handle_rx_read_buf_complete()' To: Christophe JAILLET , liuxuenetmail@gmail.com, alex.aring@gmail.com, davem@davemloft.net Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20190920194533.5886-1-christophe.jaillet@wanadoo.fr> From: Stefan Schmidt Message-ID: <388f335a-a9ae-7230-1713-a1ecb682fecf@datenfreihafen.org> Date: Sat, 21 Sep 2019 13:52:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190920194533.5886-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello Xue. On 20.09.19 21:45, Christophe JAILLET wrote: > Use a 'skb_put_data()' variant instead of rewritting it. > The __skb_put_data variant is safe here. It is obvious that the skb can > not overflow. It has just been allocated a few lines above with the same > 'len'. > > Signed-off-by: Christophe JAILLET > --- > drivers/net/ieee802154/mcr20a.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c > index 17f2300e63ee..8dc04e2590b1 100644 > --- a/drivers/net/ieee802154/mcr20a.c > +++ b/drivers/net/ieee802154/mcr20a.c > @@ -800,7 +800,7 @@ mcr20a_handle_rx_read_buf_complete(void *context) > if (!skb) > return; > > - memcpy(skb_put(skb, len), lp->rx_buf, len); > + __skb_put_data(skb, lp->rx_buf, len); > ieee802154_rx_irqsafe(lp->hw, skb, lp->rx_lqi[0]); > > print_hex_dump_debug("mcr20a rx: ", DUMP_PREFIX_OFFSET, 16, 1, > Could you please review and ACK this? If you are happy I will take it through my tree. regards Stefan Schmidt