fs/ntfs3: fix wrong cast in xattr.c
Subsystems (3)
PATCH 1/1 fs/ntfs3: fix wrong cast in xattr.c
cpu_to_be32 and be32_to_cpu respectively return and receive __be32, change the cast to the correct types.
Fixes the following sparse warnings:fs/ntfs3/xattr.c:811:48: sparse: sparse: incorrect type in
assignment (different base types)fs/ntfs3/xattr.c:901:34: sparse: sparse: cast to restricted __be32
--- fs/ntfs3/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ntfs3/xattr.c +2 -2
@@ -808,7 +808,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de, err =sizeof (u32); *(u32 *)buffer =le32_to_cpu (ni->std_fa);if (!strcmp (name,SYSTEM_NTFS_ATTRIB_BE )) - *(u32 *)buffer =cpu_to_be32 (*(u32 *)buffer); + *(__be32 *)buffer =cpu_to_be32 (*(u32 *)buffer); } goto out; }
@@ -898,7 +898,7 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,if (size !=sizeof (u32)) goto out;if (!strcmp (name,SYSTEM_NTFS_ATTRIB_BE )) - new_fa =cpu_to_le32 (be32_to_cpu (*(u32 *)value)); + new_fa =cpu_to_le32 (be32_to_cpu (*(__be32 *)value));else new_fa =cpu_to_le32 (*(u32 *)value);
Konstantin Komarov
maintainerQuoted 28 lines · Daniel Pinto
cpu_to_be32andbe32_to_cpurespectively return and receive__be32, change the cast to the correct types.Fixes the following sparse warnings:
fs/ntfs3/xattr.c:811:48: sparse: sparse: incorrect type in
assignment (different base types)fs/ntfs3/xattr.c:901:34: sparse: sparse: cast to restricted__be32Reported-by kernel test robot <[email protected]>Signed-off-by Daniel Pinto <[email protected]>--- fs/ntfs3/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ntfs3/xattr.c +1
-1@@ -808,7 +808,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de, err =sizeof (u32); *(u32 *)buffer =le32_to_cpu (ni->std_fa);if (!strcmp (name,SYSTEM_NTFS_ATTRIB_BE )) - *(u32 *)buffer =cpu_to_be32 (*(u32 *)buffer); + *(__be32 *)buffer =cpu_to_be32 (*(u32 *)buffer); } goto out; }
fs/ntfs3/xattr.c static noinline int ntfs_setxattr(const struct xattr_handler *handler, · line 903
Quoted 7 lines
fs/ntfs3/xattr.c +1
-1@@ -898,7 +898,7 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,if (size !=sizeof (u32)) goto out;if (!strcmp (name,SYSTEM_NTFS_ATTRIB_BE )) - new_fa =cpu_to_le32 (be32_to_cpu (*(u32 *)value)); + new_fa =cpu_to_le32 (be32_to_cpu (*(__be32 *)value));else new_fa =cpu_to_le32 (*(u32 *)value);
Thank you for your work, applied!