From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: don't cast string literals
Date: Thu, 14 May 2015 10:21:55 -0400 [thread overview]
Message-ID: <20150514142155.GB23683@bfoster.bfoster> (raw)
In-Reply-To: <5553DB60.6060907@redhat.com>
On Wed, May 13, 2015 at 06:16:48PM -0500, Eric Sandeen wrote:
> 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
> matter.
>
> 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@redhat.com>
> ---
>
> 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...)
>
Heh, the cast inside the directive looks weird enough to me in the first
place. In this case it seems spurious, so I'm fine with it:
Reviewed-by: Brian Foster <bfoster@redhat.com>
> 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)
> #define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2015-05-14 14:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 23:16 [PATCH] xfs: don't cast string literals Eric Sandeen
2015-05-14 14:21 ` Brian Foster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150514142155.GB23683@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.