From owner-svn-src-head@freebsd.org Tue Dec 12 20:02:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E7F4E82E3D; Tue, 12 Dec 2017 20:02:49 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29B7A7001B; Tue, 12 Dec 2017 20:02:49 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBCK2mf3043042; Tue, 12 Dec 2017 20:02:48 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBCK2maV043041; Tue, 12 Dec 2017 20:02:48 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201712122002.vBCK2maV043041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Tue, 12 Dec 2017 20:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326807 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 326807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Dec 2017 20:02:49 -0000 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);