linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / sysfs / inode.c
index f0b347b..6beee6f 100644 (file)
@@ -54,10 +54,11 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
 
        if (!sd_iattr) {
                /* setting attributes for the first time, allocate now */
-               sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL);
+               sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL);
                if (!sd_iattr)
                        return -ENOMEM;
                /* assign default attributes */
+               memset(sd_iattr, 0, sizeof(struct iattr));
                sd_iattr->ia_mode = sd->s_mode;
                sd_iattr->ia_uid = 0;
                sd_iattr->ia_gid = 0;
@@ -175,7 +176,8 @@ const unsigned char * sysfs_get_name(struct sysfs_dirent *sd)
        struct bin_attribute * bin_attr;
        struct sysfs_symlink  * sl;
 
-       BUG_ON(!sd || !sd->s_element);
+       if (!sd || !sd->s_element)
+               BUG();
 
        switch (sd->s_type) {
                case SYSFS_DIR: