All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel/param.c: add_sysfs_param memset?
@ 2011-05-09  5:56 Joe Perches
  0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2011-05-09  5:56 UTC (permalink / raw)
  To: Rusty Russell; +Cc: LKML

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-09  5:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09  5:56 kernel/param.c: add_sysfs_param memset? Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.