* [linux-next:master 8521/9759] drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode'.
@ 2022-05-09 9:26 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-05-06 18:14 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 5473 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Yong Wu <yong.wu@mediatek.com>
CC: Joerg Roedel <jroedel@suse.de>
CC: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
CC: Matthias Brugger <matthias.bgg@gmail.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 38a288f5941ef03752887ad86f2d85442358c99a
commit: d2e9a1102cfc22c08450875faa667a60f0b1b1f6 [8521/9759] iommu/mediatek: Contain MM IOMMU flow with the MM TYPE
:::::: branch date: 10 hours ago
:::::: commit date: 2 days ago
config: openrisc-randconfig-m031-20220506 (https://download.01.org/0day-ci/archive/20220507/202205070247.0InKO8AP-lkp(a)intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode'.
Old smatch warnings:
drivers/iommu/mtk_iommu.c:583 mtk_iommu_iova_to_phys() warn: impossible condition '(pa >= 5368709120) => (0-u32max >= 5368709120)'
vim +/larbnode +878 drivers/iommu/mtk_iommu.c
0df4fabe208d95 Yong Wu 2016-02-23 833
d2e9a1102cfc22 Yong Wu 2022-05-03 834 static int mtk_iommu_mm_dts_parse(struct device *dev, struct component_match **match,
d2e9a1102cfc22 Yong Wu 2022-05-03 835 struct mtk_iommu_data *data)
0df4fabe208d95 Yong Wu 2016-02-23 836 {
baf94e6ebff962 Yong Wu 2021-01-11 837 struct device_node *larbnode, *smicomm_node;
baf94e6ebff962 Yong Wu 2021-01-11 838 struct platform_device *plarbdev;
baf94e6ebff962 Yong Wu 2021-01-11 839 struct device_link *link;
d2e9a1102cfc22 Yong Wu 2022-05-03 840 int i, larb_nr, ret;
d2e9a1102cfc22 Yong Wu 2022-05-03 841
d2e9a1102cfc22 Yong Wu 2022-05-03 842 larb_nr = of_count_phandle_with_args(dev->of_node, "mediatek,larbs", NULL);
d2e9a1102cfc22 Yong Wu 2022-05-03 843 if (larb_nr < 0)
d2e9a1102cfc22 Yong Wu 2022-05-03 844 return larb_nr;
d2e9a1102cfc22 Yong Wu 2022-05-03 845
d2e9a1102cfc22 Yong Wu 2022-05-03 846 for (i = 0; i < larb_nr; i++) {
d2e9a1102cfc22 Yong Wu 2022-05-03 847 u32 id;
d2e9a1102cfc22 Yong Wu 2022-05-03 848
d2e9a1102cfc22 Yong Wu 2022-05-03 849 larbnode = of_parse_phandle(dev->of_node, "mediatek,larbs", i);
d2e9a1102cfc22 Yong Wu 2022-05-03 850 if (!larbnode)
d2e9a1102cfc22 Yong Wu 2022-05-03 851 return -EINVAL;
d2e9a1102cfc22 Yong Wu 2022-05-03 852
d2e9a1102cfc22 Yong Wu 2022-05-03 853 if (!of_device_is_available(larbnode)) {
d2e9a1102cfc22 Yong Wu 2022-05-03 854 of_node_put(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 855 continue;
d2e9a1102cfc22 Yong Wu 2022-05-03 856 }
d2e9a1102cfc22 Yong Wu 2022-05-03 857
d2e9a1102cfc22 Yong Wu 2022-05-03 858 ret = of_property_read_u32(larbnode, "mediatek,larb-id", &id);
d2e9a1102cfc22 Yong Wu 2022-05-03 859 if (ret)/* The id is consecutive if there is no this property */
d2e9a1102cfc22 Yong Wu 2022-05-03 860 id = i;
d2e9a1102cfc22 Yong Wu 2022-05-03 861
d2e9a1102cfc22 Yong Wu 2022-05-03 862 plarbdev = of_find_device_by_node(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 863 if (!plarbdev) {
d2e9a1102cfc22 Yong Wu 2022-05-03 864 of_node_put(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 865 return -ENODEV;
d2e9a1102cfc22 Yong Wu 2022-05-03 866 }
d2e9a1102cfc22 Yong Wu 2022-05-03 867 if (!plarbdev->dev.driver) {
d2e9a1102cfc22 Yong Wu 2022-05-03 868 of_node_put(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 869 return -EPROBE_DEFER;
d2e9a1102cfc22 Yong Wu 2022-05-03 870 }
d2e9a1102cfc22 Yong Wu 2022-05-03 871 data->larb_imu[id].dev = &plarbdev->dev;
d2e9a1102cfc22 Yong Wu 2022-05-03 872
d2e9a1102cfc22 Yong Wu 2022-05-03 873 component_match_add_release(dev, match, component_release_of,
d2e9a1102cfc22 Yong Wu 2022-05-03 874 component_compare_of, larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 875 }
d2e9a1102cfc22 Yong Wu 2022-05-03 876
d2e9a1102cfc22 Yong Wu 2022-05-03 877 /* Get smi-common dev from the last larb. */
d2e9a1102cfc22 Yong Wu 2022-05-03 @878 smicomm_node = of_parse_phandle(larbnode, "mediatek,smi", 0);
d2e9a1102cfc22 Yong Wu 2022-05-03 879 if (!smicomm_node)
d2e9a1102cfc22 Yong Wu 2022-05-03 880 return -EINVAL;
d2e9a1102cfc22 Yong Wu 2022-05-03 881
d2e9a1102cfc22 Yong Wu 2022-05-03 882 plarbdev = of_find_device_by_node(smicomm_node);
d2e9a1102cfc22 Yong Wu 2022-05-03 883 of_node_put(smicomm_node);
d2e9a1102cfc22 Yong Wu 2022-05-03 884 data->smicomm_dev = &plarbdev->dev;
d2e9a1102cfc22 Yong Wu 2022-05-03 885
d2e9a1102cfc22 Yong Wu 2022-05-03 886 link = device_link_add(data->smicomm_dev, dev,
d2e9a1102cfc22 Yong Wu 2022-05-03 887 DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME);
d2e9a1102cfc22 Yong Wu 2022-05-03 888 if (!link) {
d2e9a1102cfc22 Yong Wu 2022-05-03 889 dev_err(dev, "Unable to link %s.\n", dev_name(data->smicomm_dev));
d2e9a1102cfc22 Yong Wu 2022-05-03 890 return -EINVAL;
d2e9a1102cfc22 Yong Wu 2022-05-03 891 }
d2e9a1102cfc22 Yong Wu 2022-05-03 892 return 0;
d2e9a1102cfc22 Yong Wu 2022-05-03 893 }
d2e9a1102cfc22 Yong Wu 2022-05-03 894
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [linux-next:master 8521/9759] drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode'.
@ 2022-05-09 9:26 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-05-09 9:26 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4946 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 38a288f5941ef03752887ad86f2d85442358c99a
commit: d2e9a1102cfc22c08450875faa667a60f0b1b1f6 [8521/9759] iommu/mediatek: Contain MM IOMMU flow with the MM TYPE
config: openrisc-randconfig-m031-20220506 (https://download.01.org/0day-ci/archive/20220507/202205070247.0InKO8AP-lkp(a)intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode'.
vim +/larbnode +878 drivers/iommu/mtk_iommu.c
d2e9a1102cfc22 Yong Wu 2022-05-03 834 static int mtk_iommu_mm_dts_parse(struct device *dev, struct component_match **match,
d2e9a1102cfc22 Yong Wu 2022-05-03 835 struct mtk_iommu_data *data)
0df4fabe208d95 Yong Wu 2016-02-23 836 {
baf94e6ebff962 Yong Wu 2021-01-11 837 struct device_node *larbnode, *smicomm_node;
baf94e6ebff962 Yong Wu 2021-01-11 838 struct platform_device *plarbdev;
baf94e6ebff962 Yong Wu 2021-01-11 839 struct device_link *link;
d2e9a1102cfc22 Yong Wu 2022-05-03 840 int i, larb_nr, ret;
d2e9a1102cfc22 Yong Wu 2022-05-03 841
d2e9a1102cfc22 Yong Wu 2022-05-03 842 larb_nr = of_count_phandle_with_args(dev->of_node, "mediatek,larbs", NULL);
d2e9a1102cfc22 Yong Wu 2022-05-03 843 if (larb_nr < 0)
d2e9a1102cfc22 Yong Wu 2022-05-03 844 return larb_nr;
d2e9a1102cfc22 Yong Wu 2022-05-03 845
d2e9a1102cfc22 Yong Wu 2022-05-03 846 for (i = 0; i < larb_nr; i++) {
Smatch can't parse of data so it doesn't know that larb_nr can't be
zero.
d2e9a1102cfc22 Yong Wu 2022-05-03 847 u32 id;
d2e9a1102cfc22 Yong Wu 2022-05-03 848
d2e9a1102cfc22 Yong Wu 2022-05-03 849 larbnode = of_parse_phandle(dev->of_node, "mediatek,larbs", i);
d2e9a1102cfc22 Yong Wu 2022-05-03 850 if (!larbnode)
d2e9a1102cfc22 Yong Wu 2022-05-03 851 return -EINVAL;
d2e9a1102cfc22 Yong Wu 2022-05-03 852
d2e9a1102cfc22 Yong Wu 2022-05-03 853 if (!of_device_is_available(larbnode)) {
d2e9a1102cfc22 Yong Wu 2022-05-03 854 of_node_put(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 855 continue;
d2e9a1102cfc22 Yong Wu 2022-05-03 856 }
d2e9a1102cfc22 Yong Wu 2022-05-03 857
d2e9a1102cfc22 Yong Wu 2022-05-03 858 ret = of_property_read_u32(larbnode, "mediatek,larb-id", &id);
d2e9a1102cfc22 Yong Wu 2022-05-03 859 if (ret)/* The id is consecutive if there is no this property */
d2e9a1102cfc22 Yong Wu 2022-05-03 860 id = i;
d2e9a1102cfc22 Yong Wu 2022-05-03 861
d2e9a1102cfc22 Yong Wu 2022-05-03 862 plarbdev = of_find_device_by_node(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 863 if (!plarbdev) {
d2e9a1102cfc22 Yong Wu 2022-05-03 864 of_node_put(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 865 return -ENODEV;
d2e9a1102cfc22 Yong Wu 2022-05-03 866 }
d2e9a1102cfc22 Yong Wu 2022-05-03 867 if (!plarbdev->dev.driver) {
d2e9a1102cfc22 Yong Wu 2022-05-03 868 of_node_put(larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 869 return -EPROBE_DEFER;
d2e9a1102cfc22 Yong Wu 2022-05-03 870 }
d2e9a1102cfc22 Yong Wu 2022-05-03 871 data->larb_imu[id].dev = &plarbdev->dev;
d2e9a1102cfc22 Yong Wu 2022-05-03 872
d2e9a1102cfc22 Yong Wu 2022-05-03 873 component_match_add_release(dev, match, component_release_of,
d2e9a1102cfc22 Yong Wu 2022-05-03 874 component_compare_of, larbnode);
d2e9a1102cfc22 Yong Wu 2022-05-03 875 }
d2e9a1102cfc22 Yong Wu 2022-05-03 876
d2e9a1102cfc22 Yong Wu 2022-05-03 877 /* Get smi-common dev from the last larb. */
d2e9a1102cfc22 Yong Wu 2022-05-03 @878 smicomm_node = of_parse_phandle(larbnode, "mediatek,smi", 0);
d2e9a1102cfc22 Yong Wu 2022-05-03 879 if (!smicomm_node)
d2e9a1102cfc22 Yong Wu 2022-05-03 880 return -EINVAL;
d2e9a1102cfc22 Yong Wu 2022-05-03 881
d2e9a1102cfc22 Yong Wu 2022-05-03 882 plarbdev = of_find_device_by_node(smicomm_node);
d2e9a1102cfc22 Yong Wu 2022-05-03 883 of_node_put(smicomm_node);
d2e9a1102cfc22 Yong Wu 2022-05-03 884 data->smicomm_dev = &plarbdev->dev;
d2e9a1102cfc22 Yong Wu 2022-05-03 885
d2e9a1102cfc22 Yong Wu 2022-05-03 886 link = device_link_add(data->smicomm_dev, dev,
d2e9a1102cfc22 Yong Wu 2022-05-03 887 DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME);
d2e9a1102cfc22 Yong Wu 2022-05-03 888 if (!link) {
d2e9a1102cfc22 Yong Wu 2022-05-03 889 dev_err(dev, "Unable to link %s.\n", dev_name(data->smicomm_dev));
d2e9a1102cfc22 Yong Wu 2022-05-03 890 return -EINVAL;
d2e9a1102cfc22 Yong Wu 2022-05-03 891 }
d2e9a1102cfc22 Yong Wu 2022-05-03 892 return 0;
d2e9a1102cfc22 Yong Wu 2022-05-03 893 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-next:master 8521/9759] drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode'.
2022-05-09 9:26 ` Dan Carpenter
(?)
@ 2022-05-13 13:30 ` Joerg Roedel
2022-05-14 2:00 ` Yong Wu
-1 siblings, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2022-05-13 13:30 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]
On Mon, May 09, 2022 at 12:26:31PM +0300, Dan Carpenter wrote:
> d2e9a1102cfc22 Yong Wu 2022-05-03 834 static int mtk_iommu_mm_dts_parse(struct device *dev, struct component_match **match,
> d2e9a1102cfc22 Yong Wu 2022-05-03 835 struct mtk_iommu_data *data)
> 0df4fabe208d95 Yong Wu 2016-02-23 836 {
> baf94e6ebff962 Yong Wu 2021-01-11 837 struct device_node *larbnode, *smicomm_node;
> baf94e6ebff962 Yong Wu 2021-01-11 838 struct platform_device *plarbdev;
> baf94e6ebff962 Yong Wu 2021-01-11 839 struct device_link *link;
> d2e9a1102cfc22 Yong Wu 2022-05-03 840 int i, larb_nr, ret;
> d2e9a1102cfc22 Yong Wu 2022-05-03 841
> d2e9a1102cfc22 Yong Wu 2022-05-03 842 larb_nr = of_count_phandle_with_args(dev->of_node, "mediatek,larbs", NULL);
> d2e9a1102cfc22 Yong Wu 2022-05-03 843 if (larb_nr < 0)
> d2e9a1102cfc22 Yong Wu 2022-05-03 844 return larb_nr;
> d2e9a1102cfc22 Yong Wu 2022-05-03 845
> d2e9a1102cfc22 Yong Wu 2022-05-03 846 for (i = 0; i < larb_nr; i++) {
>
> Smatch can't parse of data so it doesn't know that larb_nr can't be
> zero.
Hmm, could larb_nr be zero with a broken/malicous device tree?
--
Jörg Rödel
jroedel(a)suse.de
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-next:master 8521/9759] drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode'.
2022-05-13 13:30 ` Joerg Roedel
@ 2022-05-14 2:00 ` Yong Wu
0 siblings, 0 replies; 4+ messages in thread
From: Yong Wu @ 2022-05-14 2:00 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]
On Fri, 2022-05-13 at 15:30 +0200, Joerg Roedel wrote:
> On Mon, May 09, 2022 at 12:26:31PM +0300, Dan Carpenter wrote:
> > d2e9a1102cfc22 Yong Wu 2022-05-03 834 static int
> > mtk_iommu_mm_dts_parse(struct device *dev, struct component_match
> > **match,
> > d2e9a1102cfc22 Yong Wu 2022-05-03 835
> > struct mtk_iommu_data *data)
> > 0df4fabe208d95 Yong Wu 2016-02-23 836 {
> > baf94e6ebff962 Yong Wu 2021-01-11 837 struct device_node
> > *larbnode, *smicomm_node;
> > baf94e6ebff962 Yong Wu 2021-01-11 838 struct platform_device
> > *plarbdev;
> > baf94e6ebff962 Yong Wu 2021-01-11 839 struct device_link
> > *link;
> > d2e9a1102cfc22 Yong Wu 2022-05-03 840 int i, larb_nr, ret;
> > d2e9a1102cfc22 Yong Wu 2022-05-03 841
> > d2e9a1102cfc22 Yong Wu 2022-05-03 842 larb_nr =
> > of_count_phandle_with_args(dev->of_node, "mediatek,larbs", NULL);
> > d2e9a1102cfc22 Yong Wu 2022-05-03 843 if (larb_nr < 0)
> > d2e9a1102cfc22 Yong Wu 2022-05-03 844 return larb_nr;
> > d2e9a1102cfc22 Yong Wu 2022-05-03 845
> > d2e9a1102cfc22 Yong Wu 2022-05-03 846 for (i = 0; i <
> > larb_nr; i++) {
> >
> > Smatch can't parse of data so it doesn't know that larb_nr can't be
> > zero.
>
> Hmm, could larb_nr be zero with a broken/malicous device tree?
I send a patch to fix this.
https://lore.kernel.org/linux-iommu/20220511064920.18455-4-yong.wu(a)mediatek.com/
also some other fixes in that patchset.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-14 2:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 18:14 [linux-next:master 8521/9759] drivers/iommu/mtk_iommu.c:878 mtk_iommu_mm_dts_parse() error: uninitialized symbol 'larbnode' kernel test robot
2022-05-09 9:26 ` Dan Carpenter
2022-05-13 13:30 ` Joerg Roedel
2022-05-14 2:00 ` Yong Wu
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.