Whamcloud - gitweb
b=22187 Handle the NULL pointer as legal value.
[fs/lustre-release.git] / lustre / llite / xattr.c
index 9fd0842..eecff63 100644 (file)
@@ -222,10 +222,10 @@ int ll_setxattr(struct dentry *dentry, const char *name,
                 /* Attributes that are saved via getxattr will always have
                  * the stripe_offset as 0.  Instead, the MDS should be
                  * allowed to pick the starting OST index.   b=17846 */
-                if (lump->lmm_stripe_offset == 0)
+                if (lump != NULL && lump->lmm_stripe_offset == 0)
                         lump->lmm_stripe_offset = -1;
 
-                if (S_ISREG(inode->i_mode)) {
+                if (lump != NULL && S_ISREG(inode->i_mode)) {
                         struct file f;
                         int flags = FMODE_WRITE;
 
@@ -358,6 +358,9 @@ do_getxattr:
                 GOTO(out, rc = -ERANGE);
         }
 
+        if (body->eadatasize == 0)
+                GOTO(out, rc = -ENODATA);
+
         /* do not need swab xattr data */
         xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
                                              body->eadatasize);