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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210180720.vzeCXB7g-lkp@intel.com>
Date:   Tue, 18 Oct 2022 07:25:28 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hector Martin <marcan@...can.st>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [asahilinux:bits/110-smc 13/29] lib/vsprintf.c:1783:30: sparse:
 sparse: cast to restricted __le32

tree:   https://github.com/AsahiLinux/linux bits/110-smc
head:   d23e12d136f86676385f41e5e612afe735ba8152
commit: 45968798c85661c61db86100a7504031da9e72da [13/29] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc
config: i386-randconfig-s001-20221017
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/AsahiLinux/linux/commit/45968798c85661c61db86100a7504031da9e72da
        git remote add asahilinux https://github.com/AsahiLinux/linux
        git fetch --no-tags asahilinux bits/110-smc
        git checkout 45968798c85661c61db86100a7504031da9e72da
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash

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

sparse warnings: (new ones prefixed by >>)
>> lib/vsprintf.c:1783:30: sparse: sparse: cast to restricted __le32
>> lib/vsprintf.c:1786:30: sparse: sparse: cast to restricted __be32

vim +1783 lib/vsprintf.c

  1757	
  1758	static noinline_for_stack
  1759	char *fourcc_string(char *buf, char *end, const u32 *fourcc,
  1760			    struct printf_spec spec, const char *fmt)
  1761	{
  1762		char output[sizeof("0123 little-endian (0x01234567)")];
  1763		char *p = output;
  1764		unsigned int i;
  1765		bool pix_fmt = false;
  1766		u32 orig, val;
  1767	
  1768		if (fmt[1] != 'c')
  1769			return error_string(buf, end, "(%p4?)", spec);
  1770	
  1771		if (check_pointer(&buf, end, fourcc, spec))
  1772			return buf;
  1773	
  1774		orig = get_unaligned(fourcc);
  1775		switch (fmt[2]) {
  1776		case 'h':
  1777			val = orig;
  1778			break;
  1779		case 'r':
  1780			val = orig = swab32(orig);
  1781			break;
  1782		case 'l':
> 1783			val = orig = le32_to_cpu(orig);
  1784			break;
  1785		case 'b':
> 1786			val = orig = be32_to_cpu(orig);
  1787			break;
  1788		case 'c':
  1789			/* Pixel formats are printed LSB-first */
  1790			val = swab32(orig & ~BIT(31));
  1791			pix_fmt = true;
  1792			break;
  1793		default:
  1794			return error_string(buf, end, "(%p4?)", spec);
  1795		}
  1796	
  1797		for (i = 0; i < sizeof(u32); i++) {
  1798			unsigned char c = val >> ((3 - i) * 8);
  1799	
  1800			/* Print non-control ASCII characters as-is, dot otherwise */
  1801			*p++ = isascii(c) && isprint(c) ? c : '.';
  1802		}
  1803	
  1804		if (pix_fmt) {
  1805			*p++ = ' ';
  1806			strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
  1807			p += strlen(p);
  1808		}
  1809	
  1810		*p++ = ' ';
  1811		*p++ = '(';
  1812		p = special_hex_number(p, output + sizeof(output) - 2, orig, sizeof(u32));
  1813		*p++ = ')';
  1814		*p = '\0';
  1815	
  1816		return string(buf, end, output, spec);
  1817	}
  1818	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (152393 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ