Messages in this thread Patch in this message | | | Date | Wed, 27 Jul 2011 12:55:57 +0300 | From | Dan Carpenter <> | Subject | [patch] w1: off by one in w1_f29_remove_slave() |
| |
This reads past the end of the w1_f29_sysfs_bin_files[] array. I don't have this hardware, but I assume it crashes every time the function is called.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c index c377818..0da4e97 100644 --- a/drivers/w1/slaves/w1_ds2408.c +++ b/drivers/w1/slaves/w1_ds2408.c @@ -373,7 +373,7 @@ static int w1_f29_add_slave(struct w1_slave *sl) static void w1_f29_remove_slave(struct w1_slave *sl) { int i; - for (i = NB_SYSFS_BIN_FILES; i <= 0; --i) + for (i = NB_SYSFS_BIN_FILES - 1; i <= 0; --i) sysfs_remove_bin_file(&sl->dev.kobj, &(w1_f29_sysfs_bin_files[i])); }
| |