]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/sysfs/file.c
Merge tag 'for-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb...
[karo-tx-linux.git] / fs / sysfs / file.c
index d4e6080b4b2053fae16fd451d01b6b20f813906f..00012e31829d111fbd002461b7086a70c85d29f6 100644 (file)
@@ -493,6 +493,12 @@ int sysfs_attr_ns(struct kobject *kobj, const struct attribute *attr,
        const void *ns = NULL;
        int err;
 
+       if (!dir_sd) {
+               WARN(1, KERN_ERR "sysfs: kobject %s without dirent\n",
+                       kobject_name(kobj));
+               return -ENOENT;
+       }
+
        err = 0;
        if (!sysfs_ns_type(dir_sd))
                goto out;
@@ -518,7 +524,7 @@ out:
 }
 
 int sysfs_add_file_mode(struct sysfs_dirent *dir_sd,
-                       const struct attribute *attr, int type, mode_t amode)
+                       const struct attribute *attr, int type, umode_t amode)
 {
        umode_t mode = (amode & S_IALLUGO) | S_IFREG;
        struct sysfs_addrm_cxt acxt;
@@ -618,7 +624,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
  *
  */
 int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr,
-                    mode_t mode)
+                    umode_t mode)
 {
        struct sysfs_dirent *sd;
        struct iattr newattrs;