Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 2017 20:02:48 +0000 (UTC)
From:      Fedor Uporov <fsu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326807 - head/sys/fs/ext2fs
Message-ID:  <201712122002.vBCK2maV043041@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fsu
Date: Tue Dec 12 20:02:48 2017
New Revision: 326807
URL: https://svnweb.freebsd.org/changeset/base/326807

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

Modified:
  head/sys/fs/ext2fs/ext2_extattr.c

Modified: head/sys/fs/ext2fs/ext2_extattr.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_extattr.c	Tue Dec 12 19:45:24 2017	(r326806)
+++ head/sys/fs/ext2fs/ext2_extattr.c	Tue Dec 12 20:02:48 2017	(r326807)
@@ -220,9 +220,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);
@@ -286,9 +287,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);
@@ -361,12 +363,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);
@@ -428,12 +430,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?201712122002.vBCK2maV043041>