* [jimc:m10 35/44] lib/dynamic_debug.c:854 param_set_dyndbg_module_classes() error: we previously assumed 'map' could be null (see line 841)
@ 2026-09-23 8:37 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-09-23 7:28 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jim Cromie <jim.cromie@gmail.com>
TO: "Łukasz Bartosik" <ukaszb@chromium.org>
tree: https://github.com/jimc/linux.git m10
head: f95e4f1e4ce035c9b5f8da68c66d83f2452d92d5
commit: feb8ec0044ac67921562346a4a6b831204667ea9 [35/44] dyndbg: resolve "protection" of class'd pr_debug
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: x86_64-randconfig-2200-20260923 (https://download.01.org/0day-ci/archive/20260923/202609230952.6jFrseQb-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202609230952.6jFrseQb-lkp@intel.com/
smatch warnings:
lib/dynamic_debug.c:854 param_set_dyndbg_module_classes() error: we previously assumed 'map' could be null (see line 841)
vim +/map +854 lib/dynamic_debug.c
d88925c4b39c80 Jim Cromie 2025-11-18 819
d88925c4b39c80 Jim Cromie 2025-11-18 820 /**
d88925c4b39c80 Jim Cromie 2025-11-18 821 * param_set_dyndbg_classes - class FOO >control
d88925c4b39c80 Jim Cromie 2025-11-18 822 * @instr: string echo>d to sysfs, input depends on map_type
d88925c4b39c80 Jim Cromie 2025-11-18 823 * @kp: kp->arg has state: bits/lvl, map, map_type
d88925c4b39c80 Jim Cromie 2025-11-18 824 * @mod_name: module name or null for all modules with the classes
d88925c4b39c80 Jim Cromie 2025-11-18 825 *
d88925c4b39c80 Jim Cromie 2025-11-18 826 * Enable/disable prdbgs by their class, as given in the arguments to
d88925c4b39c80 Jim Cromie 2025-11-18 827 * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative
d88925c4b39c80 Jim Cromie 2025-11-18 828 * levels by bitpos.
d88925c4b39c80 Jim Cromie 2025-11-18 829 *
d88925c4b39c80 Jim Cromie 2025-11-18 830 * Returns: 0 or <0 if error.
b9400852c0801a Jim Cromie 2022-09-04 831 */
7f10c4fc568572 Jim Cromie 2025-11-18 832 static int param_set_dyndbg_module_classes(const char *instr,
7f10c4fc568572 Jim Cromie 2025-11-18 833 const struct kernel_param *kp,
7f10c4fc568572 Jim Cromie 2025-11-18 834 const char *mod_name)
b9400852c0801a Jim Cromie 2022-09-04 835 {
feb8ec0044ac67 Jim Cromie 2025-11-18 836 struct ddebug_class_param *dcp = kp->arg;
feb8ec0044ac67 Jim Cromie 2025-11-18 837 struct ddebug_class_map *map = dcp->map;
62b32b2a95ef1c Jim Cromie 2025-11-18 838 u32 inrep, new_bits, old_bits, old_val;
b9400852c0801a Jim Cromie 2022-09-04 839 int rc, totct = 0;
b9400852c0801a Jim Cromie 2022-09-04 840
feb8ec0044ac67 Jim Cromie 2025-11-18 @841 if (map && !map->controlling_param)
feb8ec0044ac67 Jim Cromie 2025-11-18 842 map->controlling_param = dcp;
feb8ec0044ac67 Jim Cromie 2025-11-18 843
62b32b2a95ef1c Jim Cromie 2025-11-18 844 rc = kstrtou32(instr, 0, &inrep);
b9400852c0801a Jim Cromie 2022-09-04 845 if (rc) {
cec8bafd130370 Jim Cromie 2025-11-18 846 int len = strcspn(instr, "\n");
cec8bafd130370 Jim Cromie 2025-11-18 847
cec8bafd130370 Jim Cromie 2025-11-18 848 pr_err("expecting numeric input, not: %.*s > %s\n",
cec8bafd130370 Jim Cromie 2025-11-18 849 len, instr, KP_NAME(kp));
b9400852c0801a Jim Cromie 2022-09-04 850 return -EINVAL;
b9400852c0801a Jim Cromie 2022-09-04 851 }
d88925c4b39c80 Jim Cromie 2025-11-18 852 ddebug_class_param_clamp_input(&inrep, kp);
b9400852c0801a Jim Cromie 2022-09-04 853
b9400852c0801a Jim Cromie 2022-09-04 @854 switch (map->map_type) {
b9400852c0801a Jim Cromie 2022-09-04 855 case DD_CLASS_TYPE_DISJOINT_BITS:
7f10c4fc568572 Jim Cromie 2025-11-18 856 old_val = READ_ONCE(*dcp->bits);
62b32b2a95ef1c Jim Cromie 2025-11-18 857 v2pr_info("bits:0x%x > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp));
a62837264de615 Jim Cromie 2025-11-18 858 totct += ddebug_apply_class_bitmap(dcp, &inrep, old_val, mod_name);
7f10c4fc568572 Jim Cromie 2025-11-18 859 WRITE_ONCE(*dcp->bits, inrep);
b9400852c0801a Jim Cromie 2022-09-04 860 break;
b9400852c0801a Jim Cromie 2022-09-04 861 case DD_CLASS_TYPE_LEVEL_NUM:
7f10c4fc568572 Jim Cromie 2025-11-18 862 old_val = READ_ONCE(*dcp->lvl);
7f10c4fc568572 Jim Cromie 2025-11-18 863 old_bits = CLASSMAP_BITMASK(old_val);
b9400852c0801a Jim Cromie 2022-09-04 864 new_bits = CLASSMAP_BITMASK(inrep);
62b32b2a95ef1c Jim Cromie 2025-11-18 865 v2pr_info("lvl:%u bits:0x%x > %s\n", inrep, new_bits, KP_NAME(kp));
a62837264de615 Jim Cromie 2025-11-18 866 totct += ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, mod_name);
7f10c4fc568572 Jim Cromie 2025-11-18 867 WRITE_ONCE(*dcp->lvl, inrep);
b9400852c0801a Jim Cromie 2022-09-04 868 break;
b9400852c0801a Jim Cromie 2022-09-04 869 default:
b9400852c0801a Jim Cromie 2022-09-04 870 pr_warn("%s: bad map type: %d\n", KP_NAME(kp), map->map_type);
cec8bafd130370 Jim Cromie 2025-11-18 871 return -EINVAL;
b9400852c0801a Jim Cromie 2022-09-04 872 }
b9400852c0801a Jim Cromie 2022-09-04 873 vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct);
b9400852c0801a Jim Cromie 2022-09-04 874 return 0;
b9400852c0801a Jim Cromie 2022-09-04 875 }
7f10c4fc568572 Jim Cromie 2025-11-18 876
:::::: The code at line 854 was first introduced by commit
:::::: b9400852c0801aebee4fc8b62e6b7cc69c7fcbda dyndbg: add drm.debug style (drm/parameters/debug) bitmap support
:::::: TO: Jim Cromie <jim.cromie@gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* [jimc:m10 35/44] lib/dynamic_debug.c:854 param_set_dyndbg_module_classes() error: we previously assumed 'map' could be null (see line 841)
@ 2026-09-23 8:37 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-09-23 8:37 UTC (permalink / raw)
To: oe-kbuild, Jim Cromie, Łukasz Bartosik; +Cc: lkp, oe-kbuild-all
tree: https://github.com/jimc/linux.git m10
head: f95e4f1e4ce035c9b5f8da68c66d83f2452d92d5
commit: feb8ec0044ac67921562346a4a6b831204667ea9 [35/44] dyndbg: resolve "protection" of class'd pr_debug
config: x86_64-randconfig-2200-20260923 (https://download.01.org/0day-ci/archive/20260923/202609230952.6jFrseQb-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202609230952.6jFrseQb-lkp@intel.com/
smatch warnings:
lib/dynamic_debug.c:854 param_set_dyndbg_module_classes() error: we previously assumed 'map' could be null (see line 841)
vim +/map +854 lib/dynamic_debug.c
7f10c4fc568572 Jim Cromie 2025-11-18 832 static int param_set_dyndbg_module_classes(const char *instr,
7f10c4fc568572 Jim Cromie 2025-11-18 833 const struct kernel_param *kp,
7f10c4fc568572 Jim Cromie 2025-11-18 834 const char *mod_name)
b9400852c0801a Jim Cromie 2022-09-04 835 {
feb8ec0044ac67 Jim Cromie 2025-11-18 836 struct ddebug_class_param *dcp = kp->arg;
feb8ec0044ac67 Jim Cromie 2025-11-18 837 struct ddebug_class_map *map = dcp->map;
62b32b2a95ef1c Jim Cromie 2025-11-18 838 u32 inrep, new_bits, old_bits, old_val;
b9400852c0801a Jim Cromie 2022-09-04 839 int rc, totct = 0;
b9400852c0801a Jim Cromie 2022-09-04 840
feb8ec0044ac67 Jim Cromie 2025-11-18 @841 if (map && !map->controlling_param)
^^^
Can map really be NULL?
feb8ec0044ac67 Jim Cromie 2025-11-18 842 map->controlling_param = dcp;
feb8ec0044ac67 Jim Cromie 2025-11-18 843
62b32b2a95ef1c Jim Cromie 2025-11-18 844 rc = kstrtou32(instr, 0, &inrep);
b9400852c0801a Jim Cromie 2022-09-04 845 if (rc) {
cec8bafd130370 Jim Cromie 2025-11-18 846 int len = strcspn(instr, "\n");
cec8bafd130370 Jim Cromie 2025-11-18 847
cec8bafd130370 Jim Cromie 2025-11-18 848 pr_err("expecting numeric input, not: %.*s > %s\n",
cec8bafd130370 Jim Cromie 2025-11-18 849 len, instr, KP_NAME(kp));
b9400852c0801a Jim Cromie 2022-09-04 850 return -EINVAL;
b9400852c0801a Jim Cromie 2022-09-04 851 }
d88925c4b39c80 Jim Cromie 2025-11-18 852 ddebug_class_param_clamp_input(&inrep, kp);
b9400852c0801a Jim Cromie 2022-09-04 853
b9400852c0801a Jim Cromie 2022-09-04 @854 switch (map->map_type) {
^^^^^
Because if so we are in trouble.
b9400852c0801a Jim Cromie 2022-09-04 855 case DD_CLASS_TYPE_DISJOINT_BITS:
7f10c4fc568572 Jim Cromie 2025-11-18 856 old_val = READ_ONCE(*dcp->bits);
62b32b2a95ef1c Jim Cromie 2025-11-18 857 v2pr_info("bits:0x%x > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp));
a62837264de615 Jim Cromie 2025-11-18 858 totct += ddebug_apply_class_bitmap(dcp, &inrep, old_val, mod_name);
7f10c4fc568572 Jim Cromie 2025-11-18 859 WRITE_ONCE(*dcp->bits, inrep);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-23 8:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 7:28 [jimc:m10 35/44] lib/dynamic_debug.c:854 param_set_dyndbg_module_classes() error: we previously assumed 'map' could be null (see line 841) kernel test robot
2026-09-23 8:37 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.