[Top] [All Lists]

[PATCH] xfs: don't cast string literals

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs: don't cast string literals
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Wed, 13 May 2015 18:16:48 -0500
Delivered-to: xfs@xxxxxxxxxxx
The commit:

a9273ca5 xfs: convert attr to use unsigned names

added these (unsigned char *) casts, but then the _SIZE macros
return "7" - size of a pointer minus one - not the length of
the string.  This is harmless in the kernel, because the _SIZE
macros are not used, but as we sync up with userspace, this will

I don't think the cast is necessary; i.e. assigning the string
literal to an unsigned char *, or passing it to a function
expecting an unsigned char *, should be ok, right?

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

I can send the xfsprogs version if you like, if this passes
muster ;)

(the other option is to cast it back to a (char *) in the sizeof
but then things are just getting weird IMHO...)

diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 4daaa66..ff22a4d 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -1453,8 +1453,8 @@ struct xfs_acl {
                sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
 /* On-disk XFS extended attribute names */
-#define SGI_ACL_FILE           (unsigned char *)"SGI_ACL_FILE"
-#define SGI_ACL_DEFAULT                (unsigned char *)"SGI_ACL_DEFAULT"
+#define SGI_ACL_FILE           "SGI_ACL_FILE"
+#define SGI_ACL_DEFAULT                "SGI_ACL_DEFAULT"
 #define SGI_ACL_FILE_SIZE      (sizeof(SGI_ACL_FILE)-1)

<Prev in Thread] Current Thread [Next in Thread>