[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1304920615.19586.21.camel@Joe-Laptop>
Date: Sun, 08 May 2011 22:56:55 -0700
From: Joe Perches <joe@...ches.com>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: kernel/param.c: add_sysfs_param memset?
Looks wrong to me.
static __modinit int add_sysfs_param(struct module_kobject *mk,
const struct kernel_param *kp,
const char *name)
{
struct module_param_attrs *new;
struct attribute **attrs;
[]
if (!mk->mp) {
num = 0;
attrs = NULL;
} else {
num = mk->mp->num;
attrs = mk->mp->grp.attrs;
}
/* Enlarge. */
[]
attrs = krealloc(attrs, sizeof(new->grp.attrs[0])*(num+2), GFP_KERNEL);
[]
memset(&attrs[num], 0, sizeof(attrs[num]));
sizeof(attrs[num]) is a pointer.
I presume this should be
memset(&attrs[num], 0, sizeof(*attrs[num]));
or
memset(&attrs[num], 0, sizeof(struct attribute));
If it's really just to set the pointer, a set to NULL is better.
attrs[num] = NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists