[PATCH] fs/ufs: Force type conversion from __fs16 to u16

From: Bharath Vedartham
Date: Tue Apr 23 2019 - 05:01:27 EST


This patch fixes the sparse warning:
warning: restricted __fs16 degrades to integer

inode->ui_u1.oldids.ui_suid is of type __fs16, a restricted integer.
0XFFFF is a 16 bit unsigned integer. Use __force to fix the sparse
warning.

Signed-off-by: Bharath Vedartham <linux.bhar@xxxxxxxxx>
---
fs/ufs/util.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 1fd3011..b03143f 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -195,7 +195,7 @@ ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
case UFS_UID_44BSD:
return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid);
case UFS_UID_EFT:
- if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
+ if ((__force u16)inode->ui_u1.oldids.ui_suid == 0xFFFF)
return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
/* Fall through */
default:
@@ -229,7 +229,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
case UFS_UID_44BSD:
return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
case UFS_UID_EFT:
- if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
+ if ((__force u16)inode->ui_u1.oldids.ui_suid == 0xFFFF)
return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
/* Fall through */
default:
--
2.7.4