summaryrefslogtreecommitdiff
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2023-08-15 09:33:44 +0200
committerAmir Goldstein <amir73il@gmail.com>2023-10-31 00:12:59 +0200
commitd431e652600bf2708f5a5ca3b46fa1b53606d1cf (patch)
treef3c7bdcbe28bd1d5aa8a55a86d3ceb9ef9752ec5 /fs/overlayfs
parent420a62dde6ebca7bc22e6c57c9cb25d7967ff1ea (diff)
ovl: Add OVL_XATTR_TRUSTED/USER_PREFIX_LEN macros
These match the ones for e.g. XATTR_TRUSTED_PREFIX_LEN. Signed-off-by: Alexander Larsson <alexl@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/overlayfs.h2
-rw-r--r--fs/overlayfs/xattrs.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 59ee6ba79ee8..1c0ad84646e8 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -28,7 +28,9 @@ enum ovl_path_type {
#define OVL_XATTR_NAMESPACE "overlay."
#define OVL_XATTR_TRUSTED_PREFIX XATTR_TRUSTED_PREFIX OVL_XATTR_NAMESPACE
+#define OVL_XATTR_TRUSTED_PREFIX_LEN (sizeof(OVL_XATTR_TRUSTED_PREFIX) - 1)
#define OVL_XATTR_USER_PREFIX XATTR_USER_PREFIX OVL_XATTR_NAMESPACE
+#define OVL_XATTR_USER_PREFIX_LEN (sizeof(OVL_XATTR_USER_PREFIX) - 1)
enum ovl_xattr {
OVL_XATTR_OPAQUE,
diff --git a/fs/overlayfs/xattrs.c b/fs/overlayfs/xattrs.c
index 8e7e4ca62448..d20032f8a537 100644
--- a/fs/overlayfs/xattrs.c
+++ b/fs/overlayfs/xattrs.c
@@ -10,10 +10,10 @@ bool ovl_is_private_xattr(struct super_block *sb, const char *name)
if (ofs->config.userxattr)
return strncmp(name, OVL_XATTR_USER_PREFIX,
- sizeof(OVL_XATTR_USER_PREFIX) - 1) == 0;
+ OVL_XATTR_USER_PREFIX_LEN) == 0;
else
return strncmp(name, OVL_XATTR_TRUSTED_PREFIX,
- sizeof(OVL_XATTR_TRUSTED_PREFIX) - 1) == 0;
+ OVL_XATTR_TRUSTED_PREFIX_LEN) == 0;
}
static int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,