linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: netdev@vger.kernel.org, w-kwok2@ti.com, m-karicheri2@ti.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] netcp: try to reduce type confusion in descriptors
Date: Fri, 11 Dec 2015 19:34:56 -0500 (EST)	[thread overview]
Message-ID: <20151211.193456.188476874988011975.davem@davemloft.net> (raw)
In-Reply-To: <1578620.t1ANcREMZ8@wuerfel>

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 08 Dec 2015 16:32:27 +0100

> The netcp driver produces tons of warnings when CONFIG_LPAE is enabled
> on ARM:
> 
> drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_tx_map_skb':
> drivers/net/ethernet/ti/netcp_core.c:1084:13: warning: passing argument 1 of 'set_words' from incompatible pointer type [-Wincompatible-pointer-types]
> 
> This is the result of trying to pass a pointer to a dma_addr_t to
> a function that expects a u32 pointer to copy that into a DMA descriptor.
> 
> Looking at that code in more detail to fix the warnings, I see multiple
> related problems:
> 
> * The conversion functions are not endian-safe, as the DMA descriptors
>   are almost certainly fixed-endian, but the CPU is not.
> 
> * On 64-bit machines, passing a pointer through a u32 variable is a
>   bug, accessing an indirect pointer as a u32 pointer even more so.
> 
> * The handling of epib and psdata mixes native-endian and device-endian
>   data.
> 
> In this patch, I try to sort out the types for most accesses here,
> adding le32_to_cpu/cpu_to_le32 where appropriate, and passing pointers
> through two 32-bit words in the descriptor padding, to make it plausible
> that the driver does the right thing if compiled for big-endian or
> 64-bit systems.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to net-next.

      parent reply	other threads:[~2015-12-12  0:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 15:32 [PATCH 1/2] netcp: try to reduce type confusion in descriptors Arnd Bergmann
2015-12-08 15:32 ` [PATCH 2/2] netcp: add more __le32 annotations Arnd Bergmann
2015-12-12  0:35   ` David Miller
2015-12-12  0:34 ` David Miller [this message]

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=20151211.193456.188476874988011975.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=w-kwok2@ti.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;
as well as URLs for NNTP newsgroup(s).