Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp494538imm; Fri, 12 Oct 2018 01:36:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV63a9Xv7Hu88rnveijRmMmVizRMmA2AO3rWO+3EFfC1HOkKWK05zTa2nJ9isomHP3C8Uz6/m X-Received: by 2002:a63:141:: with SMTP id 62-v6mr4548644pgb.406.1539333414722; Fri, 12 Oct 2018 01:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539333414; cv=none; d=google.com; s=arc-20160816; b=VLwUA4O77aIbIrsaIKer+muCjl2N1pSrc7O+YvR9tZJ4N/yvjdjnVbYlM2zR+33Eud oa906xP+1XexAXREMbYrvf0I81C5a+lmiSP5CG7rXYv1qTjZlFsgoiT5Fbxlq8UZk0XS DHqVB1H++AG+afGn5g6Tt7LrILP+3QhfeCz6IoKcATJLTkvrWDifXwcDFmNVLcCeXFwl 3uUCm/D2RuBsL6I7tNuGh4zd4iNJRREhAtdHWVUoA1d2ictdM5UvyOfFw3S1vYhQn/DM OOPZT0S9rH/PR+W7fpQHSWRPT7xIq9jbA8CSrK5ychWyGCLT+umiO+bvzqXcwXAakiC2 ZwCA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1Odwh1A4asoz/Ba+i0VAPVBfFRm4WWbOLMmfCniQIq4=; b=V1cT5rmdcFAAwj8DpHV5Tg4sZIhwMH5vzDF22tGN1ffqmIYdRHjgcyCnoFSRyeYXr5 YWrI3JoyvdnHav6Vt35qCDpCVJFOLPLXMLrZ+JLVvc7nrYuaNrqCuX6itnHsJ3+XKr9K 0it/EVkkuG4m+E5EOb+Iiad2U6j7Y1Bp2n7HawMVx5ub8aWHjjHY23fc/YlefRlTyu86 8cdn/s4uuwWARQL12rXd9pHxzIXmjUNwKZ1IhcR4EZQXKUsSm8huo7wpr+aoYeSDs36/ Afb8xW/kTDhie53rtYMIN6Z98jOxCvSr/6Sy1k7rgE5GhajDCUMEQonHbRHaRWZ99OuG 4pHA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh4-v6si580082plb.386.2018.10.12.01.36.40; Fri, 12 Oct 2018 01:36:54 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728028AbeJLQFd (ORCPT + 99 others); Fri, 12 Oct 2018 12:05:33 -0400 Received: from imap1.codethink.co.uk ([176.9.8.82]:48203 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727524AbeJLQFc (ORCPT ); Fri, 12 Oct 2018 12:05:32 -0400 Received: from [148.252.241.226] (helo=rainbowdash) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1gAstc-0005Tc-TL; Fri, 12 Oct 2018 09:34:08 +0100 Received: from ben by rainbowdash with local (Exim 4.91) (envelope-from ) id 1gAstc-00052k-8z; Fri, 12 Oct 2018 09:34:08 +0100 From: Ben Dooks To: 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, Ben Dooks Subject: [PATCH 6/8] usbnet: smsc95xx: fix memcpy for accessing rx-data Date: Fri, 12 Oct 2018 09:34:03 +0100 Message-Id: <20181012083405.19246-7-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181012083405.19246-1-ben.dooks@codethink.co.uk> References: <20181012083405.19246-1-ben.dooks@codethink.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the RX code to use get_unaligned_le32() instead of the combo of memcpy and cpu_to_le32s(&var). 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; -- 2.19.1