lkml.org 
[lkml]   [2011]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectkernel/param.c: add_sysfs_param memset?
From
Date
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;



\
 
 \ /
  Last update: 2011-05-09 07:59    [W:0.020 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site