From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ben Dooks <ben.dooks@codethink.co.uk>, netdev@vger.kernel.org
Cc: oneukum@suse.com, davem@davemloft.net, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kernel@lists.codethink.co.uk
Subject: Re: [PATCH 6/8] usbnet: smsc95xx: fix memcpy for accessing rx-data
Date: Fri, 12 Oct 2018 11:48:44 +0300 [thread overview]
Message-ID: <58f8a006-6ede-8bf0-4f89-8ddc0674575e@cogentembedded.com> (raw)
In-Reply-To: <20181012083405.19246-7-ben.dooks@codethink.co.uk>
Hello!
On 12.10.2018 11:34, Ben Dooks wrote:
> Change the RX code to use get_unaligned_le32() instead of the combo
> of memcpy and cpu_to_le32s(&var).
le32_to_cpus(), actually.
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> drivers/net/usb/smsc95xx.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index 8ce190da8be0..03c3c02b569c 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -618,9 +618,7 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
> return;
> }
>
> - memcpy(&intdata, urb->transfer_buffer, 4);
> - le32_to_cpus(&intdata);
> -
> + intdata = get_unaligned_le32(urb->transfer_buffer);
> netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata);
>
> if (intdata & INT_ENP_PHY_INT_)
> @@ -1922,8 +1920,7 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
> unsigned char *packet;
> u16 size;
>
> - memcpy(&header, skb->data, sizeof(header));
> - le32_to_cpus(&header);
> + header = get_unaligned_le32(skb->data);
> skb_pull(skb, 4 + NET_IP_ALIGN);
> packet = skb->data;
>
MBR, Sergei
next prev parent reply other threads:[~2018-10-12 8:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 8:33 SMSC95XX updates for packet alignment and turbo mode (V2) Ben Dooks
2018-10-12 8:33 ` [PATCH 1/8] usbnet: smsc95xx: fix rx packet alignment Ben Dooks
2018-10-12 8:33 ` [PATCH 2/8] usbnet: smsc95xx: add kconfig for turbo mode Ben Dooks
2018-10-15 12:48 ` Bjørn Mork
2018-10-12 8:34 ` [PATCH 3/8] usbnet: smsc95xx: simplify tx_fixup code Ben Dooks
2018-10-12 8:34 ` [PATCH 4/8] usbnet: smsc95xx: check for csum being in last four bytes Ben Dooks
2018-10-12 8:34 ` [PATCH 5/8] usbnet: smsc95xx: align tx-buffer to word Ben Dooks
2018-10-12 8:34 ` [PATCH 6/8] usbnet: smsc95xx: fix memcpy for accessing rx-data Ben Dooks
2018-10-12 8:48 ` Sergei Shtylyov [this message]
2018-10-12 8:34 ` [PATCH 7/8] usbnet: smsc95xx: add usbnet -> priv function Ben Dooks
2018-10-12 8:34 ` [PATCH 8/8] usbnet: smsc95xx: add rx_turbo attribute Ben Dooks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58f8a006-6ede-8bf0-4f89-8ddc0674575e@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=ben.dooks@codethink.co.uk \
--cc=davem@davemloft.net \
--cc=linux-kernel@lists.codethink.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox