From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E7603D1CC9; Thu, 15 Jan 2026 17:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768497164; cv=none; b=eyocnGYEsr1F1aJPTG99PCuupjSSnxjVwWQtDc8E4IHDUjRwMgtsgK0fSznVwihLTqqx2KFgYK7SAH0lwEDsgt0L6ib3glSTmJHsIEwOI4l8Vm+2ZfxAaXaCNXejsLOkzsDk7mmwkNaZSRq/9Jz6BbJD31iDiSXmUJybSahFOpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768497164; c=relaxed/simple; bh=BZq/YTjfB0pX9U0Q+gdkOnY6H+a9W2YGW6JI+3bCJSk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NuHn+tPXICX93zhD9DCBusY6G4/8Ponr6zYCqihs1pilnjyTeHD2IaZxpFX4G7TTHFhDBW4B+EqYrWTS/4RbC1FDXqatnhvX3Pbf2RTpwCOBpfcUMf726ZThepty7ea8hrsLJvWOUdIjvRU3LVFpZ+yRa4sWrntaEncAgexbW+I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FTO2boE+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FTO2boE+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92F2BC2BC87; Thu, 15 Jan 2026 17:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768497163; bh=BZq/YTjfB0pX9U0Q+gdkOnY6H+a9W2YGW6JI+3bCJSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTO2boE+6j9Ssjgc4L6aCl+qMlnbCqisQU3PY6HKXSQG9PqL8QXKSv0o1D40r1rKO NJ/gGQSLW3k4Mnh1/UTFQkHihSEn1vFOhYpOIrn6r+tKyExW9PoLYlJSRp0vmrW2Gs J2pAatfT9krn3EwjdNR8NsQvSthWNbI3xa2YOXa4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ye Bin , Jan Kara , Theodore Tso , =?UTF-8?q?David=20Nystr=C3=B6m?= Subject: [PATCH 6.1 15/72] ext4: introduce ITAIL helper Date: Thu, 15 Jan 2026 17:48:25 +0100 Message-ID: <20260115164144.044992831@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164143.482647486@linuxfoundation.org> References: <20260115164143.482647486@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ye Bin [ Upstream commit 69f3a3039b0d0003de008659cafd5a1eaaa0a7a4 ] Introduce ITAIL helper to get the bound of xattr in inode. Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://patch.msgid.link/20250208063141.1539283-2-yebin@huaweicloud.com Signed-off-by: Theodore Ts'o Signed-off-by: David Nyström Signed-off-by: Greg Kroah-Hartman --- fs/ext4/xattr.c | 10 +++++----- fs/ext4/xattr.h | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -599,7 +599,7 @@ ext4_xattr_ibody_get(struct inode *inode return error; raw_inode = ext4_raw_inode(&iloc); header = IHDR(inode, raw_inode); - end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; + end = ITAIL(inode, raw_inode); error = xattr_check_inode(inode, header, end); if (error) goto cleanup; @@ -744,7 +744,7 @@ ext4_xattr_ibody_list(struct dentry *den return error; raw_inode = ext4_raw_inode(&iloc); header = IHDR(inode, raw_inode); - end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; + end = ITAIL(inode, raw_inode); error = xattr_check_inode(inode, header, end); if (error) goto cleanup; @@ -830,7 +830,7 @@ int ext4_get_inode_usage(struct inode *i goto out; raw_inode = ext4_raw_inode(&iloc); header = IHDR(inode, raw_inode); - end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; + end = ITAIL(inode, raw_inode); ret = xattr_check_inode(inode, header, end); if (ret) goto out; @@ -2195,7 +2195,7 @@ int ext4_xattr_ibody_find(struct inode * header = IHDR(inode, raw_inode); is->s.base = is->s.first = IFIRST(header); is->s.here = is->s.first; - is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; + is->s.end = ITAIL(inode, raw_inode); if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) { error = xattr_check_inode(inode, header, is->s.end); if (error) @@ -2746,7 +2746,7 @@ retry: */ base = IFIRST(header); - end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; + end = ITAIL(inode, raw_inode); min_offs = end - base; total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32); --- a/fs/ext4/xattr.h +++ b/fs/ext4/xattr.h @@ -68,6 +68,9 @@ struct ext4_xattr_entry { ((void *)raw_inode + \ EXT4_GOOD_OLD_INODE_SIZE + \ EXT4_I(inode)->i_extra_isize)) +#define ITAIL(inode, raw_inode) \ + ((void *)(raw_inode) + \ + EXT4_SB((inode)->i_sb)->s_inode_size) #define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1)) /*