From: kbuild test robot <lkp@intel.com>
To: "Namjae, Jeon," <namjae.jeon@samsung.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
"Al Viro" <viro@zeniv.linux.org.uk>,
"Sungjong Seo" <sj1557.seo@samsung.com>,
"Pali Rohár" <pali.rohar@gmail.com>,
"Christoph Hellwig" <hch@lst.de>
Subject: fs/exfat/nls.c:531:22: warning: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used. [redundantAssignment]
Date: Sun, 31 May 2020 13:24:05 +0800 [thread overview]
Message-ID: <202005311303.tM8DT7hg%lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ffeb595d84811dde16a28b33d8a7cf26d51d51b3
commit: b9d1e2e6265f5dc25e9f5dbfbde3e53d8a4958ac exfat: add Kconfig and Makefile
date: 3 months ago
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> fs/exfat/nls.c:531:22: warning: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used. [redundantAssignment]
p_uniname->name_len = unilen;
^
fs/exfat/nls.c:519:22: note: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used.
p_uniname->name_len = unilen & 0xFF;
^
fs/exfat/nls.c:531:22: note: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used.
p_uniname->name_len = unilen;
^
vim +531 fs/exfat/nls.c
370e812b3ec190 Namjae Jeon 2020-03-02 492
370e812b3ec190 Namjae Jeon 2020-03-02 493 static int exfat_utf8_to_utf16(struct super_block *sb,
370e812b3ec190 Namjae Jeon 2020-03-02 494 const unsigned char *p_cstring, const int len,
370e812b3ec190 Namjae Jeon 2020-03-02 495 struct exfat_uni_name *p_uniname, int *p_lossy)
370e812b3ec190 Namjae Jeon 2020-03-02 496 {
370e812b3ec190 Namjae Jeon 2020-03-02 497 int i, unilen, lossy = NLS_NAME_NO_LOSSY;
370e812b3ec190 Namjae Jeon 2020-03-02 498 unsigned short upname[MAX_NAME_LENGTH + 1];
370e812b3ec190 Namjae Jeon 2020-03-02 499 unsigned short *uniname = p_uniname->name;
370e812b3ec190 Namjae Jeon 2020-03-02 500
370e812b3ec190 Namjae Jeon 2020-03-02 501 WARN_ON(!len);
370e812b3ec190 Namjae Jeon 2020-03-02 502
370e812b3ec190 Namjae Jeon 2020-03-02 503 unilen = utf8s_to_utf16s(p_cstring, len, UTF16_HOST_ENDIAN,
370e812b3ec190 Namjae Jeon 2020-03-02 504 (wchar_t *)uniname, MAX_NAME_LENGTH + 2);
370e812b3ec190 Namjae Jeon 2020-03-02 505 if (unilen < 0) {
370e812b3ec190 Namjae Jeon 2020-03-02 506 exfat_msg(sb, KERN_ERR,
370e812b3ec190 Namjae Jeon 2020-03-02 507 "failed to %s (err : %d) nls len : %d",
370e812b3ec190 Namjae Jeon 2020-03-02 508 __func__, unilen, len);
370e812b3ec190 Namjae Jeon 2020-03-02 509 return unilen;
370e812b3ec190 Namjae Jeon 2020-03-02 510 }
370e812b3ec190 Namjae Jeon 2020-03-02 511
370e812b3ec190 Namjae Jeon 2020-03-02 512 if (unilen > MAX_NAME_LENGTH) {
370e812b3ec190 Namjae Jeon 2020-03-02 513 exfat_msg(sb, KERN_ERR,
370e812b3ec190 Namjae Jeon 2020-03-02 514 "failed to %s (estr:ENAMETOOLONG) nls len : %d, unilen : %d > %d",
370e812b3ec190 Namjae Jeon 2020-03-02 515 __func__, len, unilen, MAX_NAME_LENGTH);
370e812b3ec190 Namjae Jeon 2020-03-02 516 return -ENAMETOOLONG;
370e812b3ec190 Namjae Jeon 2020-03-02 517 }
370e812b3ec190 Namjae Jeon 2020-03-02 518
370e812b3ec190 Namjae Jeon 2020-03-02 519 p_uniname->name_len = unilen & 0xFF;
370e812b3ec190 Namjae Jeon 2020-03-02 520
370e812b3ec190 Namjae Jeon 2020-03-02 521 for (i = 0; i < unilen; i++) {
370e812b3ec190 Namjae Jeon 2020-03-02 522 if (*uniname < 0x0020 ||
370e812b3ec190 Namjae Jeon 2020-03-02 523 exfat_wstrchr(bad_uni_chars, *uniname))
370e812b3ec190 Namjae Jeon 2020-03-02 524 lossy |= NLS_NAME_LOSSY;
370e812b3ec190 Namjae Jeon 2020-03-02 525
370e812b3ec190 Namjae Jeon 2020-03-02 526 upname[i] = exfat_toupper(sb, *uniname);
370e812b3ec190 Namjae Jeon 2020-03-02 527 uniname++;
370e812b3ec190 Namjae Jeon 2020-03-02 528 }
370e812b3ec190 Namjae Jeon 2020-03-02 529
370e812b3ec190 Namjae Jeon 2020-03-02 530 *uniname = '\0';
370e812b3ec190 Namjae Jeon 2020-03-02 @531 p_uniname->name_len = unilen;
370e812b3ec190 Namjae Jeon 2020-03-02 532 p_uniname->name_hash = exfat_calc_chksum_2byte(upname, unilen << 1, 0,
370e812b3ec190 Namjae Jeon 2020-03-02 533 CS_DEFAULT);
370e812b3ec190 Namjae Jeon 2020-03-02 534
370e812b3ec190 Namjae Jeon 2020-03-02 535 if (p_lossy)
370e812b3ec190 Namjae Jeon 2020-03-02 536 *p_lossy = lossy;
370e812b3ec190 Namjae Jeon 2020-03-02 537 return unilen;
370e812b3ec190 Namjae Jeon 2020-03-02 538 }
370e812b3ec190 Namjae Jeon 2020-03-02 539
:::::: The code at line 531 was first introduced by commit
:::::: 370e812b3ec190fa492c9fd5a80c38b086d105c0 exfat: add nls operations
:::::: TO: Namjae Jeon <namjae.jeon@samsung.com>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
reply other threads:[~2020-05-31 5:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202005311303.tM8DT7hg%lkp@intel.com \
--to=lkp@intel.com \
--cc=hch@lst.de \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namjae.jeon@samsung.com \
--cc=pali.rohar@gmail.com \
--cc=sj1557.seo@samsung.com \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®