All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [opencloudos:linux-5.4/lts/5.4.119-20.0009.spr 918/2444] arch/x86/events/intel/uncore_snbep.c:3788:17-21: ERROR: eas is NULL but dereferenced.
Date: Tue, 22 Oct 2024 19:46:31 +0800	[thread overview]
Message-ID: <202410221930.CUeMYN5B-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: kaixuxia@tencent.com
TO: frankjpliu@tencent.com
TO: kasong@tencent.com
TO: sagazchen@tencent.com
TO: kernelxing@tencent.com
TO: aurelianliu@tencent.com
TO: deshengwu@tencent.com
TO: flyingpeng@tencent.com
TO: jingqunli@tencent.com
TO: jason.zeng@intel.com
TO: wu.zheng@intel.com
TO: yingbao.jia@intel.com
TO: pei.p.jia@intel.com

tree:   https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git linux-5.4/lts/5.4.119-20.0009.spr
head:   56b96e2ee1334c923cb707ff5b18d7cf858a2c46
commit: 435038c65bed240b598479fbd4002a0765affbd5 [918/2444] perf/x86/intel/uncore: Expose an Uncore unit to IIO PMON mapping
:::::: branch date: 29 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-101-20241022 (https://download.01.org/0day-ci/archive/20241022/202410221930.CUeMYN5B-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202410221930.CUeMYN5B-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> arch/x86/events/intel/uncore_snbep.c:3788:17-21: ERROR: eas is NULL but dereferenced.

vim +3788 arch/x86/events/intel/uncore_snbep.c

435038c65bed24 Roman Sudarikov 2020-06-01  3749  
435038c65bed24 Roman Sudarikov 2020-06-01  3750  static int skx_iio_set_mapping(struct intel_uncore_type *type)
435038c65bed24 Roman Sudarikov 2020-06-01  3751  {
435038c65bed24 Roman Sudarikov 2020-06-01  3752  	char buf[64];
435038c65bed24 Roman Sudarikov 2020-06-01  3753  	int ret;
435038c65bed24 Roman Sudarikov 2020-06-01  3754  	long die = -1;
435038c65bed24 Roman Sudarikov 2020-06-01  3755  	struct attribute **attrs = NULL;
435038c65bed24 Roman Sudarikov 2020-06-01  3756  	struct dev_ext_attribute *eas = NULL;
435038c65bed24 Roman Sudarikov 2020-06-01  3757  
435038c65bed24 Roman Sudarikov 2020-06-01  3758  	ret = skx_iio_get_topology(type);
435038c65bed24 Roman Sudarikov 2020-06-01  3759  	if (ret)
435038c65bed24 Roman Sudarikov 2020-06-01  3760  		return ret;
435038c65bed24 Roman Sudarikov 2020-06-01  3761  
435038c65bed24 Roman Sudarikov 2020-06-01  3762  	/* One more for NULL. */
435038c65bed24 Roman Sudarikov 2020-06-01  3763  	attrs = kcalloc((uncore_max_dies() + 1), sizeof(*attrs), GFP_KERNEL);
435038c65bed24 Roman Sudarikov 2020-06-01  3764  	if (!attrs)
435038c65bed24 Roman Sudarikov 2020-06-01  3765  		goto err;
435038c65bed24 Roman Sudarikov 2020-06-01  3766  
435038c65bed24 Roman Sudarikov 2020-06-01  3767  	eas = kcalloc(uncore_max_dies(), sizeof(*eas), GFP_KERNEL);
435038c65bed24 Roman Sudarikov 2020-06-01  3768  	if (!eas)
435038c65bed24 Roman Sudarikov 2020-06-01  3769  		goto err;
435038c65bed24 Roman Sudarikov 2020-06-01  3770  
435038c65bed24 Roman Sudarikov 2020-06-01  3771  	for (die = 0; die < uncore_max_dies(); die++) {
435038c65bed24 Roman Sudarikov 2020-06-01  3772  		sprintf(buf, "die%ld", die);
435038c65bed24 Roman Sudarikov 2020-06-01  3773  		sysfs_attr_init(&eas[die].attr.attr);
435038c65bed24 Roman Sudarikov 2020-06-01  3774  		eas[die].attr.attr.name = kstrdup(buf, GFP_KERNEL);
435038c65bed24 Roman Sudarikov 2020-06-01  3775  		if (!eas[die].attr.attr.name)
435038c65bed24 Roman Sudarikov 2020-06-01  3776  			goto err;
435038c65bed24 Roman Sudarikov 2020-06-01  3777  		eas[die].attr.attr.mode = 0444;
435038c65bed24 Roman Sudarikov 2020-06-01  3778  		eas[die].attr.show = skx_iio_mapping_show;
435038c65bed24 Roman Sudarikov 2020-06-01  3779  		eas[die].attr.store = NULL;
435038c65bed24 Roman Sudarikov 2020-06-01  3780  		eas[die].var = (void *)die;
435038c65bed24 Roman Sudarikov 2020-06-01  3781  		attrs[die] = &eas[die].attr.attr;
435038c65bed24 Roman Sudarikov 2020-06-01  3782  	}
435038c65bed24 Roman Sudarikov 2020-06-01  3783  	skx_iio_mapping_group.attrs = attrs;
435038c65bed24 Roman Sudarikov 2020-06-01  3784  
435038c65bed24 Roman Sudarikov 2020-06-01  3785  	return 0;
435038c65bed24 Roman Sudarikov 2020-06-01  3786  err:
435038c65bed24 Roman Sudarikov 2020-06-01  3787  	for (; die >= 0; die--)
435038c65bed24 Roman Sudarikov 2020-06-01 @3788  		kfree(eas[die].attr.attr.name);
435038c65bed24 Roman Sudarikov 2020-06-01  3789  	kfree(eas);
435038c65bed24 Roman Sudarikov 2020-06-01  3790  	kfree(attrs);
435038c65bed24 Roman Sudarikov 2020-06-01  3791  	kfree(type->topology);
435038c65bed24 Roman Sudarikov 2020-06-01  3792  	type->attr_update = NULL;
435038c65bed24 Roman Sudarikov 2020-06-01  3793  	return -ENOMEM;
435038c65bed24 Roman Sudarikov 2020-06-01  3794  }
435038c65bed24 Roman Sudarikov 2020-06-01  3795  

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

                 reply	other threads:[~2024-10-22 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410221930.CUeMYN5B-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.