From: Ben Hutchings <bhutchings@solarflare.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Grant Likely <grant.likely@linaro.org>,
Rob Herring <rob.herring@calxeda.com>,
"David S. Miller" <davem@davemloft.net>,
Fabio Estevam <fabio.estevam@freescale.com>,
Frank Li <Frank.Li@freescale.com>,
Jim Baxter <jim_baxter@mentor.com>,
Fugang Duan <B38611@freescale.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch v2] net/fec: cleanup types in fec_get_mac()
Date: Thu, 29 Aug 2013 18:48:58 +0000 [thread overview]
Message-ID: <1377802138.5372.12.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <20130829082514.GB14334@elgon.mountain>
On Thu, 2013-08-29 at 11:25 +0300, Dan Carpenter wrote:
> My static checker complains that on some arches unsigned longs can be 8
> characters which is larger than the buffer is only 6 chars.
> Additionally, Ben Hutchings points out that the buffer actually holds
> big endian data and the buffer we are reading from is CPU endian.
It's not really as clear-cut as that. :-) But I think it's slightly
more logical this way.
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> v2: fix endian annotations and reverse the beXX_to_cpu() calls so that
> they say cpu_to_beXX().
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index fdf9307..0b12866 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1100,10 +1100,10 @@ static void fec_get_mac(struct net_device *ndev)
> * 4) FEC mac registers set by bootloader
> */
> if (!is_valid_ether_addr(iap)) {
> - *((unsigned long *) &tmpaddr[0]) > - be32_to_cpu(readl(fep->hwp + FEC_ADDR_LOW));
> - *((unsigned short *) &tmpaddr[4]) > - be16_to_cpu(readl(fep->hwp + FEC_ADDR_HIGH) >> 16);
> + *((__be32 *) &tmpaddr[0]) > + cpu_to_be32(readl(fep->hwp + FEC_ADDR_LOW));
> + *((__be16 *) &tmpaddr[4]) > + cpu_to_be16(readl(fep->hwp + FEC_ADDR_HIGH) >> 16);
> iap = &tmpaddr[0];
> }
>
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2013-08-29 18:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 9:49 [patch] net/fec: "u32" is more explicit than "unsigned long" Dan Carpenter
2013-08-23 12:44 ` Ben Hutchings
2013-08-27 18:51 ` David Miller
2013-08-27 18:59 ` Dan Carpenter
2013-08-29 8:25 ` [patch v2] net/fec: cleanup types in fec_get_mac() Dan Carpenter
2013-08-29 18:48 ` Ben Hutchings [this message]
2013-08-30 2:02 ` Duan Fugang-B38611
2013-08-30 9:00 ` Dan Carpenter
2013-08-30 21:54 ` David Miller
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=1377802138.5372.12.camel@bwh-desktop.uk.level5networks.com \
--to=bhutchings@solarflare.com \
--cc=B38611@freescale.com \
--cc=Frank.Li@freescale.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=fabio.estevam@freescale.com \
--cc=grant.likely@linaro.org \
--cc=jim_baxter@mentor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rob.herring@calxeda.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