Re: [PATCH 04/15] nls: Split default charset from NLS core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gabriel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc4]
[cannot apply to next-20180509]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Gabriel-Krisman-Bertazi/NLS-refactor-and-UTF-8-normalization/20180509-190115
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> fs/nls/nls_default.c:118:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:118:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:118:20:    got restricted __le16 [usertype] <noident>
   fs/nls/nls_default.c:121:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:121:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:121:20:    got restricted __be16 [usertype] <noident>
>> fs/nls/nls_default.c:118:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:118:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:118:20:    got restricted __le16 [usertype] <noident>
   fs/nls/nls_default.c:121:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:121:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:121:20:    got restricted __be16 [usertype] <noident>
>> fs/nls/nls_default.c:118:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:118:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:118:20:    got restricted __le16 [usertype] <noident>
   fs/nls/nls_default.c:121:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:121:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:121:20:    got restricted __be16 [usertype] <noident>
>> fs/nls/nls_default.c:118:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:118:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:118:20:    got restricted __le16 [usertype] <noident>
   fs/nls/nls_default.c:121:20: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [short] [usertype] <noident> @@    got unsigned] [short] [usertype] <noident> @@
   fs/nls/nls_default.c:121:20:    expected unsigned short [unsigned] [short] [usertype] <noident>
   fs/nls/nls_default.c:121:20:    got restricted __be16 [usertype] <noident>
>> fs/nls/nls_default.c:174:24: sparse: cast to restricted __le16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:174:24: sparse: cast to restricted __le16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16
>> fs/nls/nls_default.c:176:24: sparse: cast to restricted __be16

vim +118 fs/nls/nls_default.c

   110	
   111	static inline void put_utf16(wchar_t *s, unsigned c, enum utf16_endian endian)
   112	{
   113		switch (endian) {
   114		default:
   115			*s = (wchar_t) c;
   116			break;
   117		case UTF16_LITTLE_ENDIAN:
 > 118			*s = __cpu_to_le16(c);
   119			break;
   120		case UTF16_BIG_ENDIAN:
 > 121			*s = __cpu_to_be16(c);
   122			break;
   123		}
   124	}
   125	
   126	int utf8s_to_utf16s(const u8 *s, int inlen, enum utf16_endian endian,
   127			wchar_t *pwcs, int maxout)
   128	{
   129		u16 *op;
   130		int size;
   131		unicode_t u;
   132	
   133		op = pwcs;
   134		while (inlen > 0 && maxout > 0 && *s) {
   135			if (*s & 0x80) {
   136				size = utf8_to_utf32(s, inlen, &u);
   137				if (size < 0)
   138					return -EINVAL;
   139				s += size;
   140				inlen -= size;
   141	
   142				if (u >= PLANE_SIZE) {
   143					if (maxout < 2)
   144						break;
   145					u -= PLANE_SIZE;
   146					put_utf16(op++, SURROGATE_PAIR |
   147							((u >> 10) & SURROGATE_BITS),
   148							endian);
   149					put_utf16(op++, SURROGATE_PAIR |
   150							SURROGATE_LOW |
   151							(u & SURROGATE_BITS),
   152							endian);
   153					maxout -= 2;
   154				} else {
   155					put_utf16(op++, u, endian);
   156					maxout--;
   157				}
   158			} else {
   159				put_utf16(op++, *s++, endian);
   160				inlen--;
   161				maxout--;
   162			}
   163		}
   164		return op - pwcs;
   165	}
   166	EXPORT_SYMBOL(utf8s_to_utf16s);
   167	
   168	static inline unsigned long get_utf16(unsigned c, enum utf16_endian endian)
   169	{
   170		switch (endian) {
   171		default:
   172			return c;
   173		case UTF16_LITTLE_ENDIAN:
 > 174			return __le16_to_cpu(c);
   175		case UTF16_BIG_ENDIAN:
 > 176			return __be16_to_cpu(c);
   177		}
   178	}
   179	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux