mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] ppc32: Fix crash on load  in DACA sound driver
Date: Wed, 03 Mar 2004 08:30:54 +1100	[thread overview]
Message-ID: <1078263053.21573.176.camel@gaston> (raw)

Hi !

The DACA sound driver (early iBook models) doesn't clear the i2c_client
structure. That cause the embedded struct device (and thus kobject) to
contain garbage in the "k_name" field, which kobject_set_name will
later try to kfree... 
Also removes references to unused struct data_data.

===== sound/oss/dmasound/dac3550a.c 1.2 vs edited =====
--- 1.2/sound/oss/dmasound/dac3550a.c	Tue Sep 30 10:25:28 2003
+++ edited/sound/oss/dmasound/dac3550a.c	Tue Mar  2 21:32:04 2004
@@ -42,11 +42,6 @@
 /* Unique ID allocation */
 static int daca_id;
 
-struct daca_data
-{
-	int arf; /* place holder for furture use */
-};
-
 struct i2c_driver daca_driver = {  
 	.owner			= THIS_MODULE,
 	.name			= "DAC3550A driver  V " DACA_VERSION,
@@ -168,12 +163,12 @@
 {
 	const char *client_name = "DAC 3550A Digital Equalizer";
 	struct i2c_client *new_client;
-	struct daca_data *data;
 	int rc = -ENODEV;
 
-	new_client = kmalloc(sizeof(*new_client) + sizeof(*data), GFP_KERNEL);
+	new_client = kmalloc(sizeof(*new_client), GFP_KERNEL);
 	if (!new_client)
 		return -ENOMEM;
+	memset(new_client, 0, sizeof(*new_client));
 
 	new_client->addr = address;
 	new_client->adapter = adapter;
@@ -181,9 +176,6 @@
 	new_client->flags = 0;
 	strcpy(new_client->name, client_name);
 	new_client->id = daca_id++; /* racy... */
-
-	data = (struct daca_data *)(new_client+1);
-	dev_set_drvdata(&new_client->dev, data);
 
 	if (daca_init_client(new_client))
 		goto bail;



             reply	other threads:[~2004-03-02 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02 21:30 Benjamin Herrenschmidt [this message]
2004-03-02 23:17 ` [PATCH] ppc32: macserial.c missing variable declaration Wojciech 'Sas' Cieciwa
2004-03-02 22:35   ` Linus Torvalds
2004-03-02 22:53     ` Benjamin Herrenschmidt

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=1078263053.21573.176.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®