Re: [PATCH v2] kconfig: fix potential NULL pointer dereference in conf_askvalue()

From: kernel test robot

Date: Sun Mar 01 2026 - 09:16:20 EST


Hi Xingjing,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on masahiroy-kbuild/for-next masahiroy-kbuild/fixes v7.0-rc1 next-20260227]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Xingjing-Deng/kconfig-fix-potential-NULL-pointer-dereference-in-conf_askvalue/20260301-133159
base: linus/master
patch link: https://lore.kernel.org/r/20260301053035.1950087-1-micro6947%40gmail.com
patch subject: [PATCH v2] kconfig: fix potential NULL pointer dereference in conf_askvalue()
config: x86_64-kexec (attached as .config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260301/202603012239.PzfGASyC-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603012239.PzfGASyC-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> scripts/kconfig/conf.c:300:22: error: expected ')'
300 | printf("%s\n", def :? "");
| ^
scripts/kconfig/conf.c:300:9: note: to match this '('
300 | printf("%s\n", def :? "");
| ^
scripts/kconfig/conf.c:308:23: error: expected ')'
308 | printf("%s\n", def :? "");
| ^
scripts/kconfig/conf.c:308:10: note: to match this '('
308 | printf("%s\n", def :? "");
| ^
2 errors generated.
make[3]: *** [scripts/Makefile.host:131: scripts/kconfig/conf.o] Error 1
make[3]: Target 'oldconfig' not remade because of errors.
make[2]: *** [Makefile:746: oldconfig] Error 2
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Target 'oldconfig' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target 'oldconfig' not remade because of errors.
--
>> scripts/kconfig/conf.c:300:22: error: expected ')'
300 | printf("%s\n", def :? "");
| ^
scripts/kconfig/conf.c:300:9: note: to match this '('
300 | printf("%s\n", def :? "");
| ^
scripts/kconfig/conf.c:308:23: error: expected ')'
308 | printf("%s\n", def :? "");
| ^
scripts/kconfig/conf.c:308:10: note: to match this '('
308 | printf("%s\n", def :? "");
| ^
2 errors generated.
make[3]: *** [scripts/Makefile.host:131: scripts/kconfig/conf.o] Error 1
make[3]: Target 'olddefconfig' not remade because of errors.
make[2]: *** [Makefile:746: olddefconfig] Error 2
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Target 'olddefconfig' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target 'olddefconfig' not remade because of errors.


vim +300 scripts/kconfig/conf.c

290
291 static int conf_askvalue(struct symbol *sym, const char *def)
292 {
293 if (!sym_has_value(sym))
294 printf("(NEW) ");
295
296 line[0] = '\n';
297 line[1] = 0;
298
299 if (!sym_is_changeable(sym)) {
> 300 printf("%s\n", def :? "");
301 return 0;
302 }
303
304 switch (input_mode) {
305 case oldconfig:
306 case syncconfig:
307 if (sym_has_value(sym)) {
308 printf("%s\n", def :? "");
309 return 0;
310 }
311 /* fall through */
312 default:
313 fflush(stdout);
314 xfgets(line, sizeof(line), stdin);
315 break;
316 }
317
318 return 1;
319 }
320

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki