ChangeSet 1.1807.56.25, 2004/08/06 15:26:03-07:00, johnpol@2ka.mipt.ru [PATCH] w1: Added w1_check_family(). w1_check_family() checks new family before registering it. Signed-off-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman drivers/w1/w1_family.c | 11 +++++++++++ 1 files changed, 11 insertions(+) diff -Nru a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c --- a/drivers/w1/w1_family.c 2004-08-23 11:04:14 -07:00 +++ b/drivers/w1/w1_family.c 2004-08-23 11:04:14 -07:00 @@ -27,11 +27,22 @@ spinlock_t w1_flock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(w1_families); +static int w1_check_family(struct w1_family *f) +{ + if (!f->fops->rname || !f->fops->rbin || !f->fops->rval || !f->fops->rvalname) + return -EINVAL; + + return 0; +} + int w1_register_family(struct w1_family *newf) { struct list_head *ent, *n; struct w1_family *f; int ret = 0; + + if (w1_check_family(newf)) + return -EINVAL; spin_lock(&w1_flock); list_for_each_safe(ent, n, &w1_families) {