public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.4] I2C updates for 2.4.28 (1/5)
Date: Sat, 20 Nov 2004 13:07:42 +0100	[thread overview]
Message-ID: <20041120130742.06079393.khali@linux-fr.org> (raw)
In-Reply-To: <20041120125423.42527051.khali@linux-fr.org>

Original report and discussion:
http://archives.andrew.net.au/lm-sensors/msg18839.html

Bottom line:
i2c_register_entry shouldn't rely on the procname field to detect the
end of the control table, but on the ctl_name field. The latter is
guaranteed to be non-zero except for the table terminator, the former
can be null even in the middle of the table.

The bug wasn't caught so far because all users of this function
(basically the lm_sensors project's drivers) were exporting all entries
through /proc so procname was never null (except for the table
terminator, obviously).

Credits go to Louis-Martin Cote for discovering the bug and proposing a
fix.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

--- linux-2.4.28-pre3/drivers/i2c/i2c-proc.c.orig	2004-09-29 22:35:29.000000000 +0200
+++ linux-2.4.28-pre3/drivers/i2c/i2c-proc.c	2004-09-29 22:34:59.000000000 +0200
@@ -152,7 +152,7 @@
 	id += 256;
 
 	len = 0;
-	while (ctl_template[len].procname)
+	while (ctl_template[len].ctl_name)
 		len++;
 	len += 7;
 	if (!(new_table = kmalloc(sizeof(ctl_table) * len, GFP_KERNEL))) {


-- 
Jean Delvare
http://khali.linux-fr.org/

  reply	other threads:[~2004-11-20 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-20 11:54 I2C updates for 2.4.28 Jean Delvare
2004-11-20 12:07 ` Jean Delvare [this message]
2004-11-20 12:16 ` [PATCH 2.4] I2C updates for 2.4.28 (2/5) Jean Delvare
2004-11-20 12:26 ` [PATCH 2.4] I2C updates for 2.4.28 (3/5) Jean Delvare
2004-11-20 12:42 ` [PATCH 2.4] I2C updates for 2.4.28 (5/5) Jean Delvare

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=20041120130742.06079393.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.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