lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202301031311.h6InTjT3-lkp@intel.com>
Date:   Tue, 3 Jan 2023 11:15:24 +0300
From:   Dan Carpenter <error27@...il.com>
To:     oe-kbuild@...ts.linux.dev, Moudy Ho <moudy.ho@...iatek.com>
Cc:     lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org,
        Ping-Hsun Wu <ping-hsun.wu@...iatek.com>,
        daoyuan huang <daoyuan.huang@...iatek.com>,
        Hans Verkuil <hverkuil@...all.nl>
Subject: drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:992
 mdp_comp_config() warn: missing unwind goto?

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   69b41ac87e4a664de78a395ff97166f0b2943210
commit: 61890ccaefaff89f5babd2c8412fd222c3f5fe38 media: platform: mtk-mdp3: add MediaTek MDP3 driver
config: ia64-randconfig-m041-20230101
compiler: ia64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>

New smatch warnings:
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:992 mdp_comp_config() warn: missing unwind goto?

Old smatch warnings:
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:872 mdp_comp_create() warn: passing devm_ allocated variable to kfree. 'comp'

vim +992 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c

61890ccaefaff8 Moudy Ho 2022-08-23   939  int mdp_comp_config(struct mdp_dev *mdp)
61890ccaefaff8 Moudy Ho 2022-08-23   940  {
61890ccaefaff8 Moudy Ho 2022-08-23   941  	struct device *dev = &mdp->pdev->dev;
61890ccaefaff8 Moudy Ho 2022-08-23   942  	struct device_node *node, *parent;
61890ccaefaff8 Moudy Ho 2022-08-23   943  	struct platform_device *pdev;
61890ccaefaff8 Moudy Ho 2022-08-23   944  	int ret;
61890ccaefaff8 Moudy Ho 2022-08-23   945  
61890ccaefaff8 Moudy Ho 2022-08-23   946  	memset(mdp_comp_alias_id, 0, sizeof(mdp_comp_alias_id));
61890ccaefaff8 Moudy Ho 2022-08-23   947  
61890ccaefaff8 Moudy Ho 2022-08-23   948  	parent = dev->of_node->parent;
61890ccaefaff8 Moudy Ho 2022-08-23   949  	/* Iterate over sibling MDP function blocks */
61890ccaefaff8 Moudy Ho 2022-08-23   950  	for_each_child_of_node(parent, node) {
61890ccaefaff8 Moudy Ho 2022-08-23   951  		const struct of_device_id *of_id;
61890ccaefaff8 Moudy Ho 2022-08-23   952  		enum mdp_comp_type type;
61890ccaefaff8 Moudy Ho 2022-08-23   953  		int id, alias_id;
61890ccaefaff8 Moudy Ho 2022-08-23   954  		struct mdp_comp *comp;
61890ccaefaff8 Moudy Ho 2022-08-23   955  
61890ccaefaff8 Moudy Ho 2022-08-23   956  		of_id = of_match_node(mdp_comp_dt_ids, node);
61890ccaefaff8 Moudy Ho 2022-08-23   957  		if (!of_id)
61890ccaefaff8 Moudy Ho 2022-08-23   958  			continue;
61890ccaefaff8 Moudy Ho 2022-08-23   959  
61890ccaefaff8 Moudy Ho 2022-08-23   960  		if (!of_device_is_available(node)) {
61890ccaefaff8 Moudy Ho 2022-08-23   961  			dev_dbg(dev, "Skipping disabled component %pOF\n",
61890ccaefaff8 Moudy Ho 2022-08-23   962  				node);
61890ccaefaff8 Moudy Ho 2022-08-23   963  			continue;
61890ccaefaff8 Moudy Ho 2022-08-23   964  		}
61890ccaefaff8 Moudy Ho 2022-08-23   965  
61890ccaefaff8 Moudy Ho 2022-08-23   966  		type = (enum mdp_comp_type)(uintptr_t)of_id->data;
61890ccaefaff8 Moudy Ho 2022-08-23   967  		alias_id = mdp_comp_alias_id[type];
61890ccaefaff8 Moudy Ho 2022-08-23   968  		id = mdp_comp_get_id(type, alias_id);
61890ccaefaff8 Moudy Ho 2022-08-23   969  		if (id < 0) {
61890ccaefaff8 Moudy Ho 2022-08-23   970  			dev_err(dev,
61890ccaefaff8 Moudy Ho 2022-08-23   971  				"Fail to get component id: type %d alias %d\n",
61890ccaefaff8 Moudy Ho 2022-08-23   972  				type, alias_id);
61890ccaefaff8 Moudy Ho 2022-08-23   973  			continue;
61890ccaefaff8 Moudy Ho 2022-08-23   974  		}
61890ccaefaff8 Moudy Ho 2022-08-23   975  		mdp_comp_alias_id[type]++;
61890ccaefaff8 Moudy Ho 2022-08-23   976  
61890ccaefaff8 Moudy Ho 2022-08-23   977  		comp = mdp_comp_create(mdp, node, id);
61890ccaefaff8 Moudy Ho 2022-08-23   978  		if (IS_ERR(comp)) {
61890ccaefaff8 Moudy Ho 2022-08-23   979  			ret = PTR_ERR(comp);
61890ccaefaff8 Moudy Ho 2022-08-23   980  			goto err_init_comps;
61890ccaefaff8 Moudy Ho 2022-08-23   981  		}
61890ccaefaff8 Moudy Ho 2022-08-23   982  
61890ccaefaff8 Moudy Ho 2022-08-23   983  		/* Only DMA capable components need the pm control */
61890ccaefaff8 Moudy Ho 2022-08-23   984  		comp->comp_dev = NULL;
61890ccaefaff8 Moudy Ho 2022-08-23   985  		if (!is_dma_capable(comp->type))
61890ccaefaff8 Moudy Ho 2022-08-23   986  			continue;
61890ccaefaff8 Moudy Ho 2022-08-23   987  
61890ccaefaff8 Moudy Ho 2022-08-23   988  		pdev = of_find_device_by_node(node);
61890ccaefaff8 Moudy Ho 2022-08-23   989  		if (!pdev) {
61890ccaefaff8 Moudy Ho 2022-08-23   990  			dev_warn(dev, "can't find platform device of node:%s\n",
61890ccaefaff8 Moudy Ho 2022-08-23   991  				 node->name);
61890ccaefaff8 Moudy Ho 2022-08-23  @992  			return -ENODEV;

Presumably this should be "goto err_init_comps;" but I have not looked
at the context out side of this email.  Normally for loops it's better
to clean up the partial iteration before doing the goto.  So undo the
mdp_comp_create() and then goto.  But again I have no context for this
code.

61890ccaefaff8 Moudy Ho 2022-08-23   993  		}
61890ccaefaff8 Moudy Ho 2022-08-23   994  
61890ccaefaff8 Moudy Ho 2022-08-23   995  		comp->comp_dev = &pdev->dev;
61890ccaefaff8 Moudy Ho 2022-08-23   996  		pm_runtime_enable(comp->comp_dev);
61890ccaefaff8 Moudy Ho 2022-08-23   997  	}
61890ccaefaff8 Moudy Ho 2022-08-23   998  
61890ccaefaff8 Moudy Ho 2022-08-23   999  	ret = mdp_comp_sub_create(mdp);
61890ccaefaff8 Moudy Ho 2022-08-23  1000  	if (ret)
61890ccaefaff8 Moudy Ho 2022-08-23  1001  		goto err_init_comps;
61890ccaefaff8 Moudy Ho 2022-08-23  1002  
61890ccaefaff8 Moudy Ho 2022-08-23  1003  	return 0;
61890ccaefaff8 Moudy Ho 2022-08-23  1004  
61890ccaefaff8 Moudy Ho 2022-08-23  1005  err_init_comps:
61890ccaefaff8 Moudy Ho 2022-08-23  1006  	mdp_comp_destroy(mdp);
61890ccaefaff8 Moudy Ho 2022-08-23  1007  	return ret;
61890ccaefaff8 Moudy Ho 2022-08-23  1008  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ