Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jan 2018 10:04:13 +0000 (UTC)
From:      Fedor Uporov <fsu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r327585 - stable/11/sys/fs/ext2fs
Message-ID:  <201801051004.w05A4DC3005985@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fsu
Date: Fri Jan  5 10:04:13 2018
New Revision: 327585
URL: https://svnweb.freebsd.org/changeset/base/327585

Log:
  MFC r326807:
  Fix extattr getters in case of neither uio nor buffer was not passed to VOP_*.
  
  Approved by:    pfg (mentor)
  
  Differential Revision:    https://reviews.freebsd.org/D13359

Modified:
  stable/11/sys/fs/ext2fs/ext2_extattr.c

Modified: stable/11/sys/fs/ext2fs/ext2_extattr.c
==============================================================================
--- stable/11/sys/fs/ext2fs/ext2_extattr.c	Fri Jan  5 10:04:01 2018	(r327584)
+++ stable/11/sys/fs/ext2fs/ext2_extattr.c	Fri Jan  5 10:04:13 2018	(r327585)
@@ -218,9 +218,10 @@ ext2_extattr_inode_list(struct inode *ip, int attrname
 			return (ENOTSUP);
 		}
 
-		if (uio == NULL)
+		if (size != NULL)
 			*size += name_len + 1;
-		else {
+
+		if (uio != NULL) {
 			char *name = malloc(name_len + 1, M_TEMP, M_WAITOK);
 			name[0] = name_len;
 			memcpy(&name[1], attr_name, name_len);
@@ -284,9 +285,10 @@ ext2_extattr_block_list(struct inode *ip, int attrname
 			return (ENOTSUP);
 		}
 
-		if (uio == NULL)
+		if (size != NULL)
 			*size += name_len + 1;
-		else {
+
+		if (uio != NULL) {
 			char *name = malloc(name_len + 1, M_TEMP, M_WAITOK);
 			name[0] = name_len;
 			memcpy(&name[1], attr_name, name_len);
@@ -359,12 +361,12 @@ ext2_extattr_inode_get(struct inode *ip, int attrnames
 
 		if (strlen(name) == name_len &&
 		    0 == strncmp(attr_name, name, name_len)) {
-			if (uio == NULL)
+			if (size != NULL)
 				*size += entry->e_value_size;
-			else {
+
+			if (uio != NULL)
 				error = uiomove(((char *)EXT2_IFIRST(header)) +
 				    entry->e_value_offs, entry->e_value_size, uio);
-			}
 
 			brelse(bp);
 			return (error);
@@ -426,12 +428,12 @@ ext2_extattr_block_get(struct inode *ip, int attrnames
 
 		if (strlen(name) == name_len &&
 		    0 == strncmp(attr_name, name, name_len)) {
-			if (uio == NULL)
+			if (size != NULL)
 				*size += entry->e_value_size;
-			else {
+
+			if (uio != NULL)
 				error = uiomove(bp->b_data + entry->e_value_offs,
 				    entry->e_value_size, uio);
-			}
 
 			brelse(bp);
 			return (error);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801051004.w05A4DC3005985>