[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202205251129.tq3cLPZW-lkp@intel.com>
Date: Wed, 25 May 2022 11:14:23 +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 1/15] lib/vsprintf.c:1802:30: sparse:
sparse: cast to restricted __le32
tree: https://github.com/AsahiLinux/linux bits/110-smc
head: 0a0b49938a3205cb2b05078117b87673c37ed319
commit: c176ff25243d5b90752858715fa622f4c78f1cb2 [1/15] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc
config: x86_64-randconfig-s022 (https://download.01.org/0day-ci/archive/20220525/202205251129.tq3cLPZW-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-14-g5a0004b5-dirty
# https://github.com/AsahiLinux/linux/commit/c176ff25243d5b90752858715fa622f4c78f1cb2
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux bits/110-smc
git checkout c176ff25243d5b90752858715fa622f4c78f1cb2
# 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=x86_64 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:1802:30: sparse: sparse: cast to restricted __le32
>> lib/vsprintf.c:1805:30: sparse: sparse: cast to restricted __be32
vim +1802 lib/vsprintf.c
1776
1777 static noinline_for_stack
1778 char *fourcc_string(char *buf, char *end, const u32 *fourcc,
1779 struct printf_spec spec, const char *fmt)
1780 {
1781 char output[sizeof("0123 little-endian (0x01234567)")];
1782 char *p = output;
1783 unsigned int i;
1784 bool pix_fmt = false;
1785 u32 orig, val;
1786
1787 if (fmt[1] != 'c')
1788 return error_string(buf, end, "(%p4?)", spec);
1789
1790 if (check_pointer(&buf, end, fourcc, spec))
1791 return buf;
1792
1793 orig = get_unaligned(fourcc);
1794 switch (fmt[2]) {
1795 case 'h':
1796 val = orig;
1797 break;
1798 case 'r':
1799 val = orig = swab32(orig);
1800 break;
1801 case 'l':
> 1802 val = orig = le32_to_cpu(orig);
1803 break;
1804 case 'b':
> 1805 val = orig = be32_to_cpu(orig);
1806 break;
1807 case 'c':
1808 /* Pixel formats are printed LSB-first */
1809 val = swab32(orig & ~BIT(31));
1810 pix_fmt = true;
1811 break;
1812 default:
1813 return error_string(buf, end, "(%p4?)", spec);
1814 }
1815
1816 for (i = 0; i < sizeof(u32); i++) {
1817 unsigned char c = val >> ((3 - i) * 8);
1818
1819 /* Print non-control ASCII characters as-is, dot otherwise */
1820 *p++ = isascii(c) && isprint(c) ? c : '.';
1821 }
1822
1823 if (pix_fmt) {
1824 *p++ = ' ';
1825 strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
1826 p += strlen(p);
1827 }
1828
1829 *p++ = ' ';
1830 *p++ = '(';
1831 p = special_hex_number(p, output + sizeof(output) - 2, orig, sizeof(u32));
1832 *p++ = ')';
1833 *p = '\0';
1834
1835 return string(buf, end, output, spec);
1836 }
1837
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists