Skip to contentSkip to conversation

drivers/gpu/drm/ast/ast_mm.c:116 ast_pci_host_is_5c01() error: we previously assumed 'child' could be null (see line 109)

PATCH In review Dan Carpenter 2 participants 2 messages Nov 6, 2024 – Nov 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 2284/2284 drivers/gpu/drm/ast/ast_mm.c:116 ast_pci_host_is_5c01() error: we previously assumed 'child' could be null (see line 109)

tree:   https://gitee.com/openeuler/kernel.git OLK-5.10
head:   f705e909a01ee9ae75542457ca95b055dae177a0
commit: 968ee436e4d0ce09994f74015dc163ef280ccc1e [2284/2284] drm/ast: Fixed display error for ps23xx when using ast bmc card
config: x86_64-randconfig-161-20241029 (https://download.01.org/0day-ci/archive/20241106/[email protected]/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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/gpu/drm/ast/ast_mm.c:116 ast_pci_host_is_5c01() error: we previously assumed 'child' could be null (see line 109)

vim +/child +116 drivers/gpu/drm/ast/ast_mm.c

968ee436e4d0ce Jiakun Shuai 2024-05-14  104  static bool ast_pci_host_is_5c01(struct pci_bus *bus)
968ee436e4d0ce Jiakun Shuai 2024-05-14  105  {
968ee436e4d0ce Jiakun Shuai 2024-05-14  106  	struct pci_bus *child = bus;
968ee436e4d0ce Jiakun Shuai 2024-05-14  107  	struct pci_dev *root = NULL;
968ee436e4d0ce Jiakun Shuai 2024-05-14  108  
968ee436e4d0ce Jiakun Shuai 2024-05-14 @109  	while (child) {
                                                       ^^^^^

We loop until child is NULL

968ee436e4d0ce Jiakun Shuai 2024-05-14  110  		if (child->parent->parent)
968ee436e4d0ce Jiakun Shuai 2024-05-14  111  			child = child->parent;
968ee436e4d0ce Jiakun Shuai 2024-05-14  112  		else
968ee436e4d0ce Jiakun Shuai 2024-05-14  113  			break;
968ee436e4d0ce Jiakun Shuai 2024-05-14  114  	}
968ee436e4d0ce Jiakun Shuai 2024-05-14  115  
968ee436e4d0ce Jiakun Shuai 2024-05-14 @116  	root = child->self;
                                                       ^^^^^^^^^^^

Dereference

968ee436e4d0ce Jiakun Shuai 2024-05-14  117  
968ee436e4d0ce Jiakun Shuai 2024-05-14  118  	if ((root->vendor == 0x1db7) && (root->device == 0x5c01))
968ee436e4d0ce Jiakun Shuai 2024-05-14  119  		return true;
968ee436e4d0ce Jiakun Shuai 2024-05-14  120  	return false;
968ee436e4d0ce Jiakun Shuai 2024-05-14  121  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw

Hi Dan,

Thank you for your report and we have noticed this bug. It will be handled and uploaded in a separate commit.

Have a good day ^_^

Quoted 41 lines

-----原始邮件-----
发件人: "Dan Carpenter" <[email protected]>
发送时间:2024-11-06 17:00:50 (星期三)
收件人: [email protected], [email protected], "Jiakun Shuai" <[email protected]>
抄送: [email protected], [email protected]
主题: [openeuler:OLK-5.10 2284/2284] drivers/gpu/drm/ast/ast_mm.c:116 ast_pci_host_is_5c01() error: we previously assumed 'child' could be null (see line 109)

tree:   https://gitee.com/openeuler/kernel.git OLK-5.10
head:   f705e909a01ee9ae75542457ca95b055dae177a0
commit: 968ee436e4d0ce09994f74015dc163ef280ccc1e [2284/2284] drm/ast: Fixed display error for ps23xx when using ast bmc card
config: x86_64-randconfig-161-20241029 (https://download.01.org/0day-ci/archive/20241106/[email protected]/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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/gpu/drm/ast/ast_mm.c:116 ast_pci_host_is_5c01() error: we previously assumed 'child' could be null (see line 109)

vim +/child +116 drivers/gpu/drm/ast/ast_mm.c

968ee436e4d0ce Jiakun Shuai 2024-05-14  104  static bool ast_pci_host_is_5c01(struct pci_bus *bus)
968ee436e4d0ce Jiakun Shuai 2024-05-14  105  {
968ee436e4d0ce Jiakun Shuai 2024-05-14  106  	struct pci_bus *child = bus;
968ee436e4d0ce Jiakun Shuai 2024-05-14  107  	struct pci_dev *root = NULL;
968ee436e4d0ce Jiakun Shuai 2024-05-14  108  
968ee436e4d0ce Jiakun Shuai 2024-05-14 @109  	while (child) {
                                                       ^^^^^

We loop until child is NULL

968ee436e4d0ce Jiakun Shuai 2024-05-14  110  		if (child->parent->parent)
968ee436e4d0ce Jiakun Shuai 2024-05-14  111  			child = child->parent;
968ee436e4d0ce Jiakun Shuai 2024-05-14  112  		else
968ee436e4d0ce Jiakun Shuai 2024-05-14  113  			break;
968ee436e4d0ce Jiakun Shuai 2024-05-14  114  	}
968ee436e4d0ce Jiakun Shuai 2024-05-14  115  
968ee436e4d0ce Jiakun Shuai 2024-05-14 @116  	root = child->self;
                                                       ^^^^^^^^^^^
Quoted 11 lines

Dereference

968ee436e4d0ce Jiakun Shuai 2024-05-14  117  
968ee436e4d0ce Jiakun Shuai 2024-05-14  118  	if ((root->vendor == 0x1db7) && (root->device == 0x5c01))
968ee436e4d0ce Jiakun Shuai 2024-05-14  119  		return true;
968ee436e4d0ce Jiakun Shuai 2024-05-14  120  	return false;
968ee436e4d0ce Jiakun Shuai 2024-05-14  121  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

------------------------------

帅家坤 Mendez Shuai | 软件适配工程师
182-0120-5229 湖南省长沙市开福区芙蓉中路1段219号富兴时代T2写字楼20楼

信息安全声明:本邮件包含信息归发件人所在组织所有,发件人所在组织对该邮件拥有所有权利。请接收者注意保密,未经发件人书面许可,不得向任何第三方组织和个人透露本邮件所含信息。
Information Security Notice: The information contained in this mail is solely property of the sender's organization.This mail communication is confidential.Recipients named above are obligated to maintain secrecy and are not permitted to disclose the contents of this communication to others.