Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev,
	Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>,
	Sebastian Reichel <sre@kernel.org>,
	Bartosz Golaszewski <bgolasze@quicinc.com>,
	Bjorn Andersson <andersson@kernel.org>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-pm@vger.kernel.org,
	Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Subject: Re: [PATCH v22 2/2] power: reset: reboot-mode: Expose sysfs for registered reboot_modes
Date: Tue, 30 Dec 2025 19:47:05 +0300	[thread overview]
Message-ID: <202512271806.n2lycyZw-lkp@intel.com> (raw)
In-Reply-To: <20251227-next-15nov_expose_sysfs-v22-2-2d153438ba19@oss.qualcomm.com>

Hi Shivendra,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Shivendra-Pratap/Documentation-ABI-Add-sysfs-class-reboot-mode-reboot_modes/20251227-025914
base:   cc3aa43b44bdb43dfbac0fcb51c56594a11338a8
patch link:    https://lore.kernel.org/r/20251227-next-15nov_expose_sysfs-v22-2-2d153438ba19%40oss.qualcomm.com
patch subject: [PATCH v22 2/2] power: reset: reboot-mode: Expose sysfs for registered reboot_modes
config: x86_64-randconfig-161-20251227 (https://download.01.org/0day-ci/archive/20251227/202512271806.n2lycyZw-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)

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 <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202512271806.n2lycyZw-lkp@intel.com/

smatch warnings:
drivers/power/reset/reboot-mode.c:147 reboot_mode_create_device() error: we previously assumed 'head' could be null (see line 112)

vim +/head +147 drivers/power/reset/reboot-mode.c

e5f49083a20ae0 Shivendra Pratap 2025-12-27  103  static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
e5f49083a20ae0 Shivendra Pratap 2025-12-27  104  {
e5f49083a20ae0 Shivendra Pratap 2025-12-27  105  	struct sysfs_data *sysfs_info;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  106  	struct sysfs_data *next;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  107  	struct list_head *head;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  108  	struct mode_info *info;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  109  	int ret;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  110  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  111  	head = kzalloc(sizeof(*head), GFP_KERNEL);
e5f49083a20ae0 Shivendra Pratap 2025-12-27 @112  	if (!head) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27  113  		ret = -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  114  		goto error;

This should just be return -ENOMEM;

e5f49083a20ae0 Shivendra Pratap 2025-12-27  115  	}
e5f49083a20ae0 Shivendra Pratap 2025-12-27  116  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  117  	INIT_LIST_HEAD(head);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  118  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  119  	list_for_each_entry(info, &reboot->head, list) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27  120  		sysfs_info = kzalloc(sizeof(*sysfs_info), GFP_KERNEL);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  121  		if (!sysfs_info) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27  122  			ret = -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  123  			goto error;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  124  		}
e5f49083a20ae0 Shivendra Pratap 2025-12-27  125  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  126  		sysfs_info->mode = kstrdup_const(info->mode, GFP_KERNEL);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  127  		if (!sysfs_info->mode) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27  128  			kfree(sysfs_info);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  129  			ret = -ENOMEM;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  130  			goto error;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  131  		}
e5f49083a20ae0 Shivendra Pratap 2025-12-27  132  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  133  		list_add_tail(&sysfs_info->list, head);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  134  	}
e5f49083a20ae0 Shivendra Pratap 2025-12-27  135  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  136  	reboot->reboot_mode_device = device_create(&reboot_mode_class, NULL, 0,
e5f49083a20ae0 Shivendra Pratap 2025-12-27  137  						   (void *)head, reboot->dev->driver->name);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  138  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  139  	if (IS_ERR(reboot->reboot_mode_device)) {
e5f49083a20ae0 Shivendra Pratap 2025-12-27  140  		ret = PTR_ERR(reboot->reboot_mode_device);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  141  		goto error;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  142  	}
e5f49083a20ae0 Shivendra Pratap 2025-12-27  143  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  144  	return 0;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  145  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  146  error:
e5f49083a20ae0 Shivendra Pratap 2025-12-27 @147  	list_for_each_entry_safe(sysfs_info, next, head, list) {
                                                                                                   ^^^^
But it is a crash instead.

e5f49083a20ae0 Shivendra Pratap 2025-12-27  148  		list_del(&sysfs_info->list);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  149  		kfree_const(sysfs_info->mode);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  150  		kfree(sysfs_info);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  151  	}
e5f49083a20ae0 Shivendra Pratap 2025-12-27  152  
e5f49083a20ae0 Shivendra Pratap 2025-12-27  153  	kfree(head);
e5f49083a20ae0 Shivendra Pratap 2025-12-27  154  	reboot->reboot_mode_device = NULL;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  155  	return ret;
e5f49083a20ae0 Shivendra Pratap 2025-12-27  156  }

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


  reply	other threads:[~2025-12-30 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-26 18:56 [PATCH v22 0/2] reboot-mode: Expose sysfs for registered reboot modes Shivendra Pratap
2025-12-26 18:56 ` [PATCH v22 1/2] Documentation: ABI: Add sysfs-class-reboot-mode-reboot_modes Shivendra Pratap
2025-12-26 18:56 ` [PATCH v22 2/2] power: reset: reboot-mode: Expose sysfs for registered reboot_modes Shivendra Pratap
2025-12-30 16:47   ` Dan Carpenter [this message]
2026-01-02 13:25   ` Bartosz Golaszewski
2026-01-05 17:45     ` Shivendra Pratap
2026-01-13 14:59       ` Bartosz Golaszewski

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=202512271806.n2lycyZw-lkp@intel.com \
    --to=dan.carpenter@linaro.org \
    --cc=andersson@kernel.org \
    --cc=bgolasze@quicinc.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=shivendra.pratap@oss.qualcomm.com \
    --cc=sre@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox