2022-07-17 05:04:02

by kernel test robot

[permalink] [raw]
Subject: arch/parisc/math-emu/driver.c:88:17: sparse: sparse: Using plain integer as NULL pointer

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 972a278fe60c361eb8f37619f562f092e8786d7c
commit: 337015573718b161891a3473d25f59273f2e626b printk: Userspace format indexing support
date: 12 months ago
config: parisc-randconfig-s042-20220717 (https://download.01.org/0day-ci/archive/20220717/[email protected]/config)
compiler: hppa64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=337015573718b161891a3473d25f59273f2e626b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 337015573718b161891a3473d25f59273f2e626b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)
>> arch/parisc/math-emu/driver.c:88:17: sparse: sparse: Using plain integer as NULL pointer
>> arch/parisc/math-emu/driver.c:88:17: sparse: sparse: Using plain integer as NULL pointer
>> arch/parisc/math-emu/driver.c:88:17: sparse: sparse: Using plain integer as NULL pointer
arch/parisc/math-emu/driver.c:90:17: sparse: sparse: Using plain integer as NULL pointer
arch/parisc/math-emu/driver.c:90:17: sparse: sparse: Using plain integer as NULL pointer
arch/parisc/math-emu/driver.c:90:17: sparse: sparse: Using plain integer as NULL pointer
arch/parisc/math-emu/driver.c:93:22: sparse: sparse: undefined identifier 'decode_fpu'

vim +88 arch/parisc/math-emu/driver.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 64
^1da177e4c3f41 Linus Torvalds 2005-04-16 65 /* Handle a floating point exception. Return zero if the faulting
^1da177e4c3f41 Linus Torvalds 2005-04-16 66 instruction can be completed successfully. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 67 int
^1da177e4c3f41 Linus Torvalds 2005-04-16 68 handle_fpe(struct pt_regs *regs)
^1da177e4c3f41 Linus Torvalds 2005-04-16 69 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 70 extern void printbinary(unsigned long x, int nbits);
^1da177e4c3f41 Linus Torvalds 2005-04-16 71 unsigned int orig_sw, sw;
^1da177e4c3f41 Linus Torvalds 2005-04-16 72 int signalcode;
^1da177e4c3f41 Linus Torvalds 2005-04-16 73 /* need an intermediate copy of float regs because FPU emulation
^1da177e4c3f41 Linus Torvalds 2005-04-16 74 * code expects an artificial last entry which contains zero
^1da177e4c3f41 Linus Torvalds 2005-04-16 75 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 76 * also, the passed in fr registers contain one word that defines
^1da177e4c3f41 Linus Torvalds 2005-04-16 77 * the fpu type. the fpu type information is constructed
^1da177e4c3f41 Linus Torvalds 2005-04-16 78 * inside the emulation code
^1da177e4c3f41 Linus Torvalds 2005-04-16 79 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 80 __u64 frcopy[36];
^1da177e4c3f41 Linus Torvalds 2005-04-16 81
^1da177e4c3f41 Linus Torvalds 2005-04-16 82 memcpy(frcopy, regs->fr, sizeof regs->fr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 83 frcopy[32] = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 84
^1da177e4c3f41 Linus Torvalds 2005-04-16 85 memcpy(&orig_sw, frcopy, sizeof(orig_sw));
^1da177e4c3f41 Linus Torvalds 2005-04-16 86
^1da177e4c3f41 Linus Torvalds 2005-04-16 87 if (FPUDEBUG) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 @88 printk(KERN_DEBUG "FP VZOUICxxxxCQCQCQCQCQCRMxxTDVZOUI ->\n ");

:::::: The code at line 88 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>

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


2022-07-17 06:57:17

by Chris Down

[permalink] [raw]
Subject: Re: arch/parisc/math-emu/driver.c:88:17: sparse: sparse: Using plain integer as NULL pointer

The real issue is this:

../arch/parisc/math-emu/decode_exc.c: In function 'decode_fpu':
../arch/parisc/math-emu/decode_exc.c:49:25: error: expected identifier before numeric constant
49 | #define fmt 11 /* bits 19 & 20 */
| ^~
../include/linux/printk.h:391:34: note: in expansion of macro 'fmt'
391 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \

And that's why you don't define such shortly named, ambiguous macros. The
simplest fix is probably just to have this file and others like it use _printk.

I'll send a patch and cc linux-parisc.

2022-07-17 07:26:01

by Chris Down

[permalink] [raw]
Subject: Re: arch/parisc/math-emu/driver.c:88:17: sparse: sparse: Using plain integer as NULL pointer

Oh, looks like that's already fixed by commit 7f2dcc7371c1 ("parisc: math-emu:
Avoid "fmt" macro collision"). I don't know why the sparse warning is still
there then, but moving to _printk certainly fixes it. I'll try to work out why
before sending the patch to at least give a reasonable changelog.