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  linux-cve-announce  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:   Mon, 19 Jul 2021 10:42:21 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Tobin C. Harding" <tobin@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Shuah Khan <skhan@...uxfoundation.org>,
        Sasha Levin <sashal@...nel.org>
Subject: [linux-stable-rc:linux-4.4.y 1357/1774] lib/string.c:286:29:
 warning: comparison of integer expressions of different signedness:
 'ssize_t' {aka 'long int'} and 'long unsigned int'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
head:   38c92ba3580f0d00e57a55caf8f880aa1a0f2a50
commit: 651b7091172395ceb9c72e3595c20319f7290118 [1357/1774] lib/string: Add strscpy_pad() function
config: h8300-randconfig-r031-20210718 (attached as .config)
compiler: h8300-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=651b7091172395ceb9c72e3595c20319f7290118
        git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
        git fetch --no-tags linux-stable-rc linux-4.4.y
        git checkout 651b7091172395ceb9c72e3595c20319f7290118
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   lib/string.c: In function 'strscpy_pad':
>> lib/string.c:286:29: warning: comparison of integer expressions of different signedness: 'ssize_t' {aka 'long int'} and 'long unsigned int' [-Wsign-compare]
     286 |  if (written < 0 || written == count - 1)
         |                             ^~


vim +286 lib/string.c

   261	
   262	/**
   263	 * strscpy_pad() - Copy a C-string into a sized buffer
   264	 * @dest: Where to copy the string to
   265	 * @src: Where to copy the string from
   266	 * @count: Size of destination buffer
   267	 *
   268	 * Copy the string, or as much of it as fits, into the dest buffer.  The
   269	 * behavior is undefined if the string buffers overlap.  The destination
   270	 * buffer is always %NUL terminated, unless it's zero-sized.
   271	 *
   272	 * If the source string is shorter than the destination buffer, zeros
   273	 * the tail of the destination buffer.
   274	 *
   275	 * For full explanation of why you may want to consider using the
   276	 * 'strscpy' functions please see the function docstring for strscpy().
   277	 *
   278	 * Return: The number of characters copied (not including the trailing
   279	 *         %NUL) or -E2BIG if the destination buffer wasn't big enough.
   280	 */
   281	ssize_t strscpy_pad(char *dest, const char *src, size_t count)
   282	{
   283		ssize_t written;
   284	
   285		written = strscpy(dest, src, count);
 > 286		if (written < 0 || written == count - 1)
   287			return written;
   288	
   289		memset(dest + written + 1, 0, count - written - 1);
   290	
   291		return written;
   292	}
   293	EXPORT_SYMBOL(strscpy_pad);
   294	

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

Download attachment ".config.gz" of type "application/gzip" (16395 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ