linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Miller <davem@davemloft.net>,
	Sachin Sant <sachinp@in.ibm.com>, Jiri Pirko <jpirko@redhat.com>,
	linux-next@vger.kernel.org, linuxppc-dev@ozlabs.org,
	netdev@vger.kernel.org
Subject: Re: [PowerPC] Next May 8 boot failure: OOPS during ibmveth moduleinit
Date: Tue, 12 May 2009 16:17:32 +0800	[thread overview]
Message-ID: <4A09309C.8000404@cn.fujitsu.com> (raw)
In-Reply-To: <20090512174451.eeed4126.sfr@canb.auug.org.au>

Stephen Rothwell wrote:
> Hi Dave,
>
> This fixes it (I wonder if this bug is lurking in any other drivers):
>   

Yes, there are some other exists. This spatch script can help to found this.
(http://www.emn.fr/x-info/coccinelle/)

# cat netdev_dev_addr.cocci
@@
struct net_device *dev;
@@
memcpy(
- &dev->dev_addr
+ dev->dev_addr
, ...);

@@
struct net_device *dev;
expression E;
@@
memcpy(E,
- &dev->dev_addr
+ dev->dev_addr
, ...);

@@
expression E;
@@
- &E->dev_addr
+ E->dev_addr


> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 12 May 2009 17:24:02 +1000
> Subject: [PATCH] net/ibmveth: fix panic in probe
>
> netdev->dev_addr changed from being an array to being a pointer, so we
> should not take its address for memcpy().
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  drivers/net/ibmveth.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
> index 7902e5e..8daffad 100644
> --- a/drivers/net/ibmveth.c
> +++ b/drivers/net/ibmveth.c
> @@ -1285,7 +1285,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
>   	netdev->features |= NETIF_F_LLTX;
>  	spin_lock_init(&adapter->stats_lock);
>  
> -	memcpy(&netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
> +	memcpy(netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
>  
>  	for(i = 0; i<IbmVethNumBufferPools; i++) {
>  		struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;
>   

maybe this line should be fix too.


@@ -1368,7 +1368,7 @@ static void ibmveth_proc_unregister_driv
 static int ibmveth_show(struct seq_file *seq, void *v)
 {
 	struct ibmveth_adapter *adapter = seq->private;
-	char *current_mac = ((char*) &adapter->netdev->dev_addr);
+	char *current_mac = ((char*) adapter->netdev->dev_addr);
 	char *firmware_mac = ((char*) &adapter->mac_addr) ;
 
 	seq_printf(seq, "%s %s\n\n", ibmveth_driver_string, ibmveth_driver_version);

  parent reply	other threads:[~2009-05-12  8:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-08  8:02 linux-next: Tree for May 8 Stephen Rothwell
2009-05-08 12:52 ` [PowerPC] Next May 8 boot failure: OOPS during ibmveth module init Sachin Sant
2009-05-08 19:57   ` David Miller
2009-05-08 22:33     ` Jiri Pirko
2009-05-11 17:07       ` [PowerPC] Next May 8 boot failure: OOPS during ibmveth moduleinit Sachin Sant
2009-05-12  7:04         ` Stephen Rothwell
2009-05-12  7:44           ` Stephen Rothwell
2009-05-12  8:16             ` Jiri Pirko
2009-05-12  8:17             ` Wei Yongjun [this message]
2009-05-13  6:39             ` Stephen Rothwell

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=4A09309C.8000404@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=jpirko@redhat.com \
    --cc=linux-next@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=sachinp@in.ibm.com \
    --cc=sfr@canb.auug.org.au \
    /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).