* [krzk-github:track/x1e80100-t14s 1001/1079] drivers/pmdomain/arm/scmi_perf_domain.c:129:82: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 63
@ 2025-02-19 0:07 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-02-19 0:07 UTC (permalink / raw)
To: Sibi Sankar; +Cc: oe-kbuild-all, Abel Vesa, Johan Hovold
tree: https://github.com/krzk/linux track/x1e80100-t14s
head: 0a5b996575143038f96d880868109359ede28367
commit: d8b0f632f663f5a46a3a519c3a387a5a61c418b7 [1001/1079] pmdomain: arm: Fix debugfs node creation failure
config: arm-randconfig-004-20250219 (https://download.01.org/0day-ci/archive/20250219/202502190729.8e7FEnhS-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250219/202502190729.8e7FEnhS-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502190729.8e7FEnhS-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/pmdomain/arm/scmi_perf_domain.c: In function 'scmi_perf_domain_probe':
>> drivers/pmdomain/arm/scmi_perf_domain.c:129:82: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
129 | snprintf(scmi_pd->domain_name, sizeof(scmi_pd->domain_name), "%s-%d",
| ^~
drivers/pmdomain/arm/scmi_perf_domain.c:129:78: note: directive argument in the range [0, 2147483646]
129 | snprintf(scmi_pd->domain_name, sizeof(scmi_pd->domain_name), "%s-%d",
| ^~~~~~~
drivers/pmdomain/arm/scmi_perf_domain.c:129:17: note: 'snprintf' output between 3 and 75 bytes into a destination of size 64
129 | snprintf(scmi_pd->domain_name, sizeof(scmi_pd->domain_name), "%s-%d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130 | scmi_pd->info->name, scmi_pd->domain_id);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +129 drivers/pmdomain/arm/scmi_perf_domain.c
77
78 static int scmi_perf_domain_probe(struct scmi_device *sdev)
79 {
80 struct device *dev = &sdev->dev;
81 const struct scmi_handle *handle = sdev->handle;
82 const struct scmi_perf_proto_ops *perf_ops;
83 struct scmi_protocol_handle *ph;
84 struct scmi_perf_domain *scmi_pd;
85 struct genpd_onecell_data *scmi_pd_data;
86 struct generic_pm_domain **domains;
87 int num_domains, i, ret = 0;
88
89 if (!handle)
90 return -ENODEV;
91
92 /* The OF node must specify us as a power-domain provider. */
93 if (!of_find_property(dev->of_node, "#power-domain-cells", NULL))
94 return 0;
95
96 perf_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PERF, &ph);
97 if (IS_ERR(perf_ops))
98 return PTR_ERR(perf_ops);
99
100 num_domains = perf_ops->num_domains_get(ph);
101 if (num_domains < 0) {
102 dev_warn(dev, "Failed with %d when getting num perf domains\n",
103 num_domains);
104 return num_domains;
105 } else if (!num_domains) {
106 return 0;
107 }
108
109 scmi_pd = devm_kcalloc(dev, num_domains, sizeof(*scmi_pd), GFP_KERNEL);
110 if (!scmi_pd)
111 return -ENOMEM;
112
113 scmi_pd_data = devm_kzalloc(dev, sizeof(*scmi_pd_data), GFP_KERNEL);
114 if (!scmi_pd_data)
115 return -ENOMEM;
116
117 domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL);
118 if (!domains)
119 return -ENOMEM;
120
121 for (i = 0; i < num_domains; i++, scmi_pd++) {
122 scmi_pd->info = perf_ops->info_get(ph, i);
123
124 scmi_pd->domain_id = i;
125 scmi_pd->perf_ops = perf_ops;
126 scmi_pd->ph = ph;
127
128 /* Domain attributes can report identical names across domains */
> 129 snprintf(scmi_pd->domain_name, sizeof(scmi_pd->domain_name), "%s-%d",
130 scmi_pd->info->name, scmi_pd->domain_id);
131
132 scmi_pd->genpd.name = scmi_pd->domain_name;
133 scmi_pd->genpd.flags = GENPD_FLAG_ALWAYS_ON |
134 GENPD_FLAG_OPP_TABLE_FW;
135 scmi_pd->genpd.set_performance_state = scmi_pd_set_perf_state;
136 scmi_pd->genpd.attach_dev = scmi_pd_attach_dev;
137 scmi_pd->genpd.detach_dev = scmi_pd_detach_dev;
138
139 ret = pm_genpd_init(&scmi_pd->genpd, NULL, false);
140 if (ret)
141 goto err;
142
143 domains[i] = &scmi_pd->genpd;
144 }
145
146 scmi_pd_data->domains = domains;
147 scmi_pd_data->num_domains = num_domains;
148
149 ret = of_genpd_add_provider_onecell(dev->of_node, scmi_pd_data);
150 if (ret)
151 goto err;
152
153 dev_set_drvdata(dev, scmi_pd_data);
154 dev_info(dev, "Initialized %d performance domains", num_domains);
155 return 0;
156 err:
157 for (i--; i >= 0; i--)
158 pm_genpd_remove(domains[i]);
159 return ret;
160 }
161
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-19 0:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 0:07 [krzk-github:track/x1e80100-t14s 1001/1079] drivers/pmdomain/arm/scmi_perf_domain.c:129:82: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 63 kernel test robot
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.