Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp504312imm; Fri, 12 Oct 2018 01:49:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV63tWA+zi4nlsgBZ/wczKXIQDEWn/WB4stMxZ/IYln+iUK37MviVcqTncl8IzkH3um/lquWj X-Received: by 2002:a63:3f07:: with SMTP id m7-v6mr4779787pga.115.1539334177082; Fri, 12 Oct 2018 01:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539334177; cv=none; d=google.com; s=arc-20160816; b=OmDeq01Azad9nFnGd6CmqMh9g4fNDKaAdmOGDu70F/ryGawWK8A+iVueBLG1ViH3OO XWzt6TjHcQAA2QnX2OL51VE9g5Z2wWib92AovH9JCjjLO9MdS5+7bLk69BfLQ7J3GOSa OEgkJ7EPqti/sOJhvVrrDZJapkoShGx9mr9kPhy1hK9X5HF0mMGDMJ3dW1HmfpHHbOCu s0GvcGn8Xkv3V73IFOKJGo6M7UBpxIpVFrYrnrW4U5pGaRTLRPSIP/dsTO+MsaK19Pcl bcp96kiIXMef6kek5MrrRy6uptRH+RASggtGPUe1ke1kF5UynQzA+3iBK9LlttCRclzA iKig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=6ZOYUDAZSi1TMvENS472MIUKsIMRneTkCHMkzr7+w4w=; b=R8ajcirnIVdNpdG1WewmBlqd5fGcbNqZed10DJiIrcj6u4V5iKlpUItT/QhgXTmJal rXDTZCXxykSchSEeG+EnawFUSHeoDbKEzQ5ChEbxUKuXdjC6apHM0/jQNN1iKxhIuy1/ nV+IvRgXQi4RCSM9VYw0HRzCdBF9w0vtQF92N0zSIy0cSfKv/yWeis77KV1uHFAGWsvE eBeA2hSphwcHPuSIWjO/g0p3E4lKrlO+8FxVQ5qSp/2VP7xt+iEGEgyLXfMrimr2hqbf rom+jS4hFUuRBwi5aXVT4CZ1ap74f3SJrU7ojCA413FFPt4azBLirmomQPc4SJIfibXD nrmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=rzyiDRf7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7-v6si597245pgj.532.2018.10.12.01.49.20; Fri, 12 Oct 2018 01:49:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=rzyiDRf7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbeJLQUV (ORCPT + 99 others); Fri, 12 Oct 2018 12:20:21 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34639 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727952AbeJLQUV (ORCPT ); Fri, 12 Oct 2018 12:20:21 -0400 Received: by mail-lf1-f66.google.com with SMTP id y10-v6so8786036lfj.1 for ; Fri, 12 Oct 2018 01:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=6ZOYUDAZSi1TMvENS472MIUKsIMRneTkCHMkzr7+w4w=; b=rzyiDRf7LMNRE3no779C14INkslsaavGT2rjCIrY/PysgEmTM839pwxTcBAWTJdQwI FbFg/ADCSDqVcopPNMrrVIh0bsSjDM8QDpIHAt5EO9DkVj23bhKyFgsyZDedazro139e +7q17+1YHBJJhdlWYkj0f4yikAWTbk9cxqVGrhXtrusbxXPi+cMI3PCY16SzieZcQxD7 21BUa21rIzBNfyx6wU7YfiDCRAgTNAIlqDKLQ16Sp/xNEDKDZQIfZQ1xFk2SA4f9VINf sZ0flr9brMzbxjRdzlU9sIP+UoNUfZOdWKCtPndsrO92yl7cjNCO+DF1u6zsbdh01qm7 QlmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=6ZOYUDAZSi1TMvENS472MIUKsIMRneTkCHMkzr7+w4w=; b=pOlAPOXuhQlPR5FbrT2xPu3FPI2SO9WiFk6BWhQ/x7/UN+ZdZgirbOiJh6t3RpKjEY apNMiU8dhx8uMMIfJ3a9mmnVVuEz8Kst6YRrQzK8fbm2BC9kK63+RpWgnoqDA/ZJXZAu 0tfAqllzEKgfMVa7yC19yQRcSwue6IKaZhyrcWjlBzmO+V1MLEqGnF0WrngO5rq/V7dS G+X8/7QoRutce6AcSrqBkLn30Mz1peNIbZuVjgC6sXzama5rpi14fnlo8AklPdbXr6in 1Yom32qoCb6eI5/nHJd3dhVExQRisE0a6V/R5nYKWLVWELgoJxKVx2qRffkdeagqmGWF 2aJw== X-Gm-Message-State: ABuFfojiYmdBX6osDfd3bEAI2AucAilm/KQD5+s0Zxsut7UK1T1FzBAM YQQYjZlTGjjuP5x50mY/YpxWRg== X-Received: by 2002:a19:2102:: with SMTP id h2-v6mr3108822lfh.119.1539334136584; Fri, 12 Oct 2018 01:48:56 -0700 (PDT) Received: from [192.168.0.200] ([31.173.87.27]) by smtp.gmail.com with ESMTPSA id o19-v6sm119372lff.36.2018.10.12.01.48.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 01:48:55 -0700 (PDT) Subject: Re: [PATCH 6/8] usbnet: smsc95xx: fix memcpy for accessing rx-data To: Ben Dooks , netdev@vger.kernel.org References: <20181012083405.19246-1-ben.dooks@codethink.co.uk> <20181012083405.19246-7-ben.dooks@codethink.co.uk> Cc: oneukum@suse.com, davem@davemloft.net, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel@lists.codethink.co.uk From: Sergei Shtylyov Message-ID: <58f8a006-6ede-8bf0-4f89-8ddc0674575e@cogentembedded.com> Date: Fri, 12 Oct 2018 11:48:44 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20181012083405.19246-7-ben.dooks@codethink.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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