From: kernel test robot <lkp@intel.com>
To: Sibi Sankar <quic_sibis@quicinc.com>
Cc: oe-kbuild-all@lists.linux.dev, Abel Vesa <abel.vesa@linaro.org>,
Johan Hovold <johan+linaro@kernel.org>
Subject: [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
Date: Wed, 19 Feb 2025 08:07:28 +0800 [thread overview]
Message-ID: <202502190729.8e7FEnhS-lkp@intel.com> (raw)
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
reply other threads:[~2025-02-19 0:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202502190729.8e7FEnhS-lkp@intel.com \
--to=lkp@intel.com \
--cc=abel.vesa@linaro.org \
--cc=johan+linaro@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=quic_sibis@quicinc.com \
/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 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.