Patchwork [v2] typhoon: Use request_firmware()

login
register
mail settings
Submitter David Miller
Date March 2, 2009, 9:53 a.m.
Message ID <20090302.015315.181629191.davem@davemloft.net>
Download mbox | patch
Permalink /patch/23930/
State Accepted
Delegated to: David Miller
Headers show

Comments

David Miller - March 2, 2009, 9:53 a.m.
From: David Dillow <dave@thedillows.org>
Date: Mon, 02 Mar 2009 02:56:19 -0500

> On Sun, 2009-03-01 at 20:29 -0800, David Miller wrote:
> > +
> > +	typhoon_fw_image = kmalloc(typhoon_fw->size, GFP_KERNEL);
> > +	if (!typhoon_fw_image) {
> > +		err = -ENOMEM;
> > +		goto out_err;
> >  	}
> 
> You never copied the image into the kmalloc'd memory, so you upload
> garbage.
> 
> Fix that and I think it will be OK.

Good catch, I've checked in the following fix:

typhoon: Add missing firmware copy.

Noticed by David Dillow.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/typhoon.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index ec2541c..9bba787 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -1377,6 +1377,7 @@  typhoon_request_firmware(struct typhoon *tp)
 		err = -ENOMEM;
 		goto out_err;
 	}
+	memcpy(typhoon_fw_image, typhoon_fw->data, typhoon_fw->size);
 
 	return 0;