lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 31 May 2020 13:24:05 +0800
From:   kbuild test robot <lkp@...el.com>
To:     "Namjae, Jeon," <namjae.jeon@...sung.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Al Viro <viro@...iv.linux.org.uk>,
        Sungjong Seo <sj1557.seo@...sung.com>,
        Pali Rohár <pali.rohar@...il.com>,
        Christoph Hellwig <hch@....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]

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@...el.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@...sung.com>
:::::: CC: Al Viro <viro@...iv.linux.org.uk>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists