lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 25 Sep 2018 02:00:35 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Moritz Fischer <mdf@...nel.org>
Cc:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        keescook@...omium.org, davem@...emloft.net,
        moritz.fischer@...us.com, f.fainelli@...il.com,
        alex.williams@...com
Subject: Re: [PATCH] net: nixge: Address compiler warnings when building for
 i386

On Mon, Sep 24, 2018 at 02:27:12PM -0700, Moritz Fischer wrote:
> Address compiler warnings reported by kbuild autobuilders
> when building for i386 as a result of dma_addr_t size on
> different architectures.
> 
> warning: cast to pointer from integer of different size
> 	[-Wint-to-pointer-cast]
> 
> Signed-off-by: Moritz Fischer <mdf@...nel.org>
> ---
>  drivers/net/ethernet/ni/nixge.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
> index 74cf52e3fb09..0611f2335b4a 100644
> --- a/drivers/net/ethernet/ni/nixge.c
> +++ b/drivers/net/ethernet/ni/nixge.c
> @@ -127,8 +127,8 @@ struct nixge_hw_dma_bd {
>  #ifdef CONFIG_PHYS_ADDR_T_64BIT
>  #define nixge_hw_dma_bd_set_addr(bd, field, addr) \
>  	do { \
> -		(bd)->field##_lo = lower_32_bits(((u64)addr)); \
> -		(bd)->field##_hi = upper_32_bits(((u64)addr)); \
> +		(bd)->field##_lo = lower_32_bits((addr)); \
> +		(bd)->field##_hi = upper_32_bits((addr)); \
>  	} while (0)

Hi Maritz

Maybe turn this into an function. It is small enough it will get
inlined.  You then gain type checking. Make addr a void *.

>  #else
>  #define nixge_hw_dma_bd_set_addr(bd, field, addr) \
> @@ -251,7 +251,7 @@ static void nixge_hw_dma_bd_release(struct net_device *ndev)
>  				 NIXGE_MAX_JUMBO_FRAME_SIZE,
>  				 DMA_FROM_DEVICE);
>  
> -		skb = (struct sk_buff *)
> +		skb = (struct sk_buff *)(uintptr_t)
>  			nixge_hw_dma_bd_get_addr(&priv->rx_bd_v[i],
>  						 sw_id_offset);

How about making nixge_hw_dma_bd_get_addr return a void *. You can
assign that to anything without needing a cast.

       Andrew

Powered by blists - more mailing lists