From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Dooks Subject: Re: [PATCH] usbnet: smsc95xx: simplify tx_fixup code Date: Sat, 06 Oct 2018 12:27:27 +0100 Message-ID: <40033993674bb8b5ef33ac33f28f3aff@codethink.co.uk> References: <59988ed22559410881addfecf58335eb@AcuMS.aculab.com> <20181002165602.21033-1-ben.dooks@codethink.co.uk> <20181005.142412.601607260441380535.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, David.Laight@aculab.com, oneukum@suse.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel@lists.codethink.co.uk To: David Miller Return-path: Received: from imap1.codethink.co.uk ([176.9.8.82]:51644 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727161AbeJFSaY (ORCPT ); Sat, 6 Oct 2018 14:30:24 -0400 In-Reply-To: <20181005.142412.601607260441380535.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org List-ID: On 2018-10-05 22:24, David Miller wrote: > From: Ben Dooks > Date: Tue, 2 Oct 2018 17:56:02 +0100 > >> - memcpy(skb->data, &tx_cmd_a, 4); >> + ptr = skb_push(skb, 8); >> + tx_cmd_a = cpu_to_le32(tx_cmd_a); >> + tx_cmd_b = cpu_to_le32(tx_cmd_b); >> + memcpy(ptr, &tx_cmd_a, 4); >> + memcpy(ptr+4, &tx_cmd_b, 4); > > Even a memcpy() through a void pointer does not guarantee that gcc will > not emit word sized loads and stores. > > You must use the get_unaligned()/put_unaligned() facilities to do this > properly. Thanks, got a new version of the series just being tested with this. Should it go into the original, or as a separate change? > > I also agree that making a proper type and structure instead of using > a void pointer would be better.