netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: Emilian.Medve@freescale.com
Cc: jgarzik@pobox.com, leoli@freescale.com, netdev@vger.kernel.org,
	linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] [POWERPC] ucc_geth: Eliminate compile warnings
Date: Thu, 18 Oct 2007 17:30:32 -0700 (PDT)	[thread overview]
Message-ID: <20071018.173032.48505868.davem@davemloft.net> (raw)
In-Reply-To: <1192745713-20829-1-git-send-email-Emilian.Medve@Freescale.com>

From: Emil Medve <Emilian.Medve@freescale.com>
Date: Thu, 18 Oct 2007 17:15:13 -0500

> drivers/net/ucc_geth.c: In function 'ucc_geth_startup':
> drivers/net/ucc_geth.c:2614: warning: assignment makes integer from pointer without a cast
> drivers/net/ucc_geth.c:2651: warning: assignment makes integer from pointer without a cast
> 
> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>

It only kills the warning on 32-bit systems, the cast is wrong
either way.

>  			ugeth->tx_bd_ring_offset[j] =
> -				kmalloc((u32) (length + align), GFP_KERNEL);
> +				(u32)kmalloc(length + align, GFP_KERNEL);
>  
>  			if (ugeth->tx_bd_ring_offset[j] != 0)
>  				ugeth->p_tx_bd_ring[j] =

Pointers can be up to "unsigned long" in size, therefore that
is the minimal amount of storage you need to store them into
if they are needed in integer form for some reason.

Any cast from pointer to integer like this is a huge red flag.

  reply	other threads:[~2007-10-19  0:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18 22:15 [PATCH] [POWERPC] ucc_geth: Eliminate compile warnings Emil Medve
2007-10-19  0:30 ` David Miller [this message]
2007-10-19 13:39   ` Medve Emilian-EMMEDVE1
2007-10-19 23:41     ` David Miller
2007-10-22 13:47       ` Medve Emilian-EMMEDVE1
2007-10-23  3:38         ` Li Yang-r58472
2007-10-23 17:10         ` Scott Wood
2007-10-19 14:35 ` Timur Tabi

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=20071018.173032.48505868.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Emilian.Medve@freescale.com \
    --cc=jgarzik@pobox.com \
    --cc=leoli@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    /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).