[lkml]   [2004]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 2.4] I2C updates for 2.4.28 (1/5)
Original report and discussion:

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

Signed-off-by: Jean Delvare <>

--- 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 += 7;
if (!(new_table = kmalloc(sizeof(ctl_table) * len, GFP_KERNEL))) {

Jean Delvare
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:08    [W:0.038 / U:8.816 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site