Hi "Pali,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on cifs/for-next]
[also build test WARNING on shaggy/jfs-next linus/master v5.14-rc5 next-20210809]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Pali-Roh-r/fs-Remove-usage-of-br...
base:
git://git.samba.org/sfrench/cifs-2.6.git for-next
config: i386-randconfig-s031-20210809 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-348-gf0e6938b-dirty
#
https://github.com/0day-ci/linux/commit/b4774ffabcd1b71732f963467b1b5dd42...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Pali-Roh-r/fs-Remove-usage-of-broken-nls_utf8-and-drop-it/20210809-002825
git checkout b4774ffabcd1b71732f963467b1b5dd426f4ad3b
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> fs/ntfs/unistr.c:259:70: sparse: sparse: incorrect type in
argument 4 (different base types) @@ expected unsigned short [usertype] *pwcs @@
got restricted __le16 [usertype] *[assigned] ucs @@
fs/ntfs/unistr.c:259:70:
sparse: expected unsigned short [usertype] *pwcs
fs/ntfs/unistr.c:259:70: sparse: got restricted __le16 [usertype] *[assigned] ucs
> fs/ntfs/unistr.c:354:45: sparse: sparse: incorrect type in
argument 1 (different base types) @@ expected unsigned short const [usertype] *pwcs @@
got restricted __le16 const [usertype] *ins @@
fs/ntfs/unistr.c:354:45:
sparse: expected unsigned short const [usertype] *pwcs
fs/ntfs/unistr.c:354:45: sparse: got restricted __le16 const [usertype] *ins
vim +259 fs/ntfs/unistr.c
221
222 /**
223 * ntfs_nlstoucs - convert NLS string to little endian Unicode string
224 * @vol: ntfs volume which we are working with
225 * @ins: input NLS string buffer
226 * @ins_len: length of input string in bytes
227 * @outs: on return contains the allocated output Unicode string buffer
228 *
229 * Convert the input string @ins, which is in whatever format the loaded NLS
230 * map dictates, into a little endian, 2-byte Unicode string.
231 *
232 * This function allocates the string and the caller is responsible for
233 * calling kmem_cache_free(ntfs_name_cache, *@outs); when finished with it.
234 *
235 * On success the function returns the number of Unicode characters written to
236 * the output string *@outs (>= 0), not counting the terminating Unicode NULL
237 * character. *@outs is set to the allocated output string buffer.
238 *
239 * On error, a negative number corresponding to the error code is returned. In
240 * that case the output string is not allocated. Both *@outs and *@outs_len
241 * are then undefined.
242 *
243 * This might look a bit odd due to fast path optimization...
244 */
245 int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
246 const int ins_len, ntfschar **outs)
247 {
248 struct nls_table *nls = vol->nls_map;
249 ntfschar *ucs;
250 wchar_t wc;
251 int i, o, wc_len;
252
253 /* We do not trust outside sources. */
254 if (likely(ins)) {
255 ucs = kmem_cache_alloc(ntfs_name_cache, GFP_NOFS);
256 if (likely(ucs)) {
257 if (!nls) {
258 wc_len = utf8s_to_utf16s(ins, ins_len,
259 UTF16_LITTLE_ENDIAN, ucs,
260 NTFS_MAX_NAME_LEN);
261 if (wc_len < 0 || wc_len >= NTFS_MAX_NAME_LEN)
262 goto name_err;
263 ucs[wc_len] = 0;
264 *outs = ucs;
265 return o;
266 }
267 for (i = o = 0; i < ins_len; i += wc_len) {
268 wc_len = nls->char2uni(ins + i, ins_len - i,
269 &wc);
270 if (likely(wc_len >= 0 &&
271 o < NTFS_MAX_NAME_LEN)) {
272 if (likely(wc)) {
273 ucs[o++] = cpu_to_le16(wc);
274 continue;
275 } /* else if (!wc) */
276 break;
277 } /* else if (wc_len < 0 ||
278 o >= NTFS_MAX_NAME_LEN) */
279 goto name_err;
280 }
281 ucs[o] = 0;
282 *outs = ucs;
283 return o;
284 } /* else if (!ucs) */
285 ntfs_error(vol->sb, "Failed to allocate buffer for converted "
286 "name from ntfs_name_cache.");
287 return -ENOMEM;
288 } /* else if (!ins) */
289 ntfs_error(vol->sb, "Received NULL pointer.");
290 return -EINVAL;
291 name_err:
292 kmem_cache_free(ntfs_name_cache, ucs);
293 if (wc_len < 0) {
294 ntfs_error(vol->sb, "Name using character set %s contains "
295 "characters that cannot be converted to "
296 "Unicode.", nls ? nls->charset : "utf8");
297 i = -EILSEQ;
298 } else /* if (o >= NTFS_MAX_NAME_LEN) */ {
299 ntfs_error(vol->sb, "Name is too long (maximum length for a "
300 "name on NTFS is %d Unicode characters.",
301 NTFS_MAX_NAME_LEN);
302 i = -ENAMETOOLONG;
303 }
304 return i;
305 }
306
307 /**
308 * ntfs_ucstonls - convert little endian Unicode string to NLS string
309 * @vol: ntfs volume which we are working with
310 * @ins: input Unicode string buffer
311 * @ins_len: length of input string in Unicode characters
312 * @outs: on return contains the (allocated) output NLS string buffer
313 * @outs_len: length of output string buffer in bytes
314 *
315 * Convert the input little endian, 2-byte Unicode string @ins, of length
316 * @ins_len into the string format dictated by the loaded NLS.
317 *
318 * If *@outs is NULL, this function allocates the string and the caller is
319 * responsible for calling kfree(*@outs); when finished with it. In this case
320 * @outs_len is ignored and can be 0.
321 *
322 * On success the function returns the number of bytes written to the output
323 * string *@outs (>= 0), not counting the terminating NULL byte. If the output
324 * string buffer was allocated, *@outs is set to it.
325 *
326 * On error, a negative number corresponding to the error code is returned. In
327 * that case the output string is not allocated. The contents of *@outs are
328 * then undefined.
329 *
330 * This might look a bit odd due to fast path optimization...
331 */
332 int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
333 const int ins_len, unsigned char **outs, int outs_len)
334 {
335 struct nls_table *nls = vol->nls_map;
336 unsigned char *ns;
337 int i, o, ns_len, wc;
338
339 /* We don't trust outside sources. */
340 if (ins) {
341 ns = *outs;
342 ns_len = outs_len;
343 if (ns && !ns_len) {
344 wc = -ENAMETOOLONG;
345 goto conversion_err;
346 }
347 if (!ns) {
348 ns_len = ins_len * (nls ? NLS_MAX_CHARSET_SIZE : 4);
349 ns = kmalloc(ns_len + 1, GFP_NOFS);
350 if (!ns)
351 goto mem_err_out;
352 }
353 if (!nls) {
354 o = utf16s_to_utf8s(ins, ins_len, UTF16_LITTLE_ENDIAN,
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org