* [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction
@ 2026-04-23 7:09 Dan Carpenter
2026-05-06 4:02 ` Shyam Sundar S K
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-04-23 7:09 UTC (permalink / raw)
To: Shyam Sundar S K; +Cc: platform-driver-x86
Hello Shyam Sundar S K,
Commit ae82cef7d9c5 ("platform/x86/amd/pmf: Add support for PMF-TA
interaction") from Dec 12, 2023 (linux-next), leads to the following
Smatch static checker warning:
drivers/platform/x86/amd/pmf/tee-if.c:261 amd_pmf_invoke_cmd_enact() warn: set error code if 'arg.ret != 0'
drivers/platform/x86/amd/pmf/tee-if.c:307 amd_pmf_invoke_cmd_init() warn: set error code if 'arg.ret != 0'
drivers/platform/x86/amd/pmf/tee-if.c
234 int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
235 {
236 struct ta_pmf_shared_memory *ta_sm = NULL;
237 struct ta_pmf_enact_result *out = NULL;
238 struct ta_pmf_enact_table *in = NULL;
239 struct tee_param param[MAX_TEE_PARAM];
240 struct tee_ioctl_invoke_arg arg;
241 int ret = 0;
242
243 if (!dev->tee_ctx)
244 return -ENODEV;
245
246 memset(dev->shbuf, 0, dev->policy_sz);
247 ta_sm = dev->shbuf;
248 out = &ta_sm->pmf_output.policy_apply_table;
249 in = &ta_sm->pmf_input.enact_table;
250
251 memset(ta_sm, 0, sizeof(*ta_sm));
252 ta_sm->command_id = TA_PMF_COMMAND_POLICY_BUILDER_ENACT_POLICIES;
253 ta_sm->if_version = PMF_TA_IF_VERSION_MAJOR;
254
255 amd_pmf_populate_ta_inputs(dev, in);
256 amd_pmf_prepare_args(dev, TA_PMF_COMMAND_POLICY_BUILDER_ENACT_POLICIES, &arg, param);
257
258 ret = tee_client_invoke_func(dev->tee_ctx, &arg, param);
259 if (ret < 0 || arg.ret != 0) {
260 dev_err(dev->dev, "TEE enact cmd failed. err: %x, ret:%d\n", arg.ret, ret);
--> 261 return ret;
return ret ?: -EINVAL? (not sure what kind of error codes are stored in
arg.ret).
262 }
263
264 if (ta_sm->pmf_result == TA_PMF_TYPE_SUCCESS && out->actions_count) {
265 amd_pmf_dump_ta_inputs(dev, in);
266 dev_dbg(dev->dev, "action count:%u result:%x\n", out->actions_count,
267 ta_sm->pmf_result);
268 amd_pmf_apply_policies(dev, out);
269 }
270
271 return 0;
272 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction
2026-04-23 7:09 [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction Dan Carpenter
@ 2026-05-06 4:02 ` Shyam Sundar S K
0 siblings, 0 replies; 2+ messages in thread
From: Shyam Sundar S K @ 2026-05-06 4:02 UTC (permalink / raw)
To: Dan Carpenter; +Cc: platform-driver-x86
Hi Dan,
I was OOO. Apologies for the long delay in responding back on this
thread.
On 4/23/2026 12:39, Dan Carpenter wrote:
> [You don't often get email from error27@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hello Shyam Sundar S K,
>
> Commit ae82cef7d9c5 ("platform/x86/amd/pmf: Add support for PMF-TA
> interaction") from Dec 12, 2023 (linux-next), leads to the following
> Smatch static checker warning:
>
> drivers/platform/x86/amd/pmf/tee-if.c:261 amd_pmf_invoke_cmd_enact() warn: set error code if 'arg.ret != 0'
> drivers/platform/x86/amd/pmf/tee-if.c:307 amd_pmf_invoke_cmd_init() warn: set error code if 'arg.ret != 0'
>
> drivers/platform/x86/amd/pmf/tee-if.c
> 234 int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
> 235 {
> 236 struct ta_pmf_shared_memory *ta_sm = NULL;
> 237 struct ta_pmf_enact_result *out = NULL;
> 238 struct ta_pmf_enact_table *in = NULL;
> 239 struct tee_param param[MAX_TEE_PARAM];
> 240 struct tee_ioctl_invoke_arg arg;
> 241 int ret = 0;
> 242
> 243 if (!dev->tee_ctx)
> 244 return -ENODEV;
> 245
> 246 memset(dev->shbuf, 0, dev->policy_sz);
> 247 ta_sm = dev->shbuf;
> 248 out = &ta_sm->pmf_output.policy_apply_table;
> 249 in = &ta_sm->pmf_input.enact_table;
> 250
> 251 memset(ta_sm, 0, sizeof(*ta_sm));
> 252 ta_sm->command_id = TA_PMF_COMMAND_POLICY_BUILDER_ENACT_POLICIES;
> 253 ta_sm->if_version = PMF_TA_IF_VERSION_MAJOR;
> 254
> 255 amd_pmf_populate_ta_inputs(dev, in);
> 256 amd_pmf_prepare_args(dev, TA_PMF_COMMAND_POLICY_BUILDER_ENACT_POLICIES, &arg, param);
> 257
> 258 ret = tee_client_invoke_func(dev->tee_ctx, &arg, param);
> 259 if (ret < 0 || arg.ret != 0) {
> 260 dev_err(dev->dev, "TEE enact cmd failed. err: %x, ret:%d\n", arg.ret, ret);
> --> 261 return ret;
>
> return ret ?: -EINVAL? (not sure what kind of error codes are stored in
> arg.ret).
Yes.
return ret ?: -EINVAL is the right thing to do in this case.
But I quickly ran the smatch and could not catch the problem what you
is being reported. Can you let me know how to trigger this warning?
Thanks,
Shyam
>
> 262 }
> 263
> 264 if (ta_sm->pmf_result == TA_PMF_TYPE_SUCCESS && out->actions_count) {
> 265 amd_pmf_dump_ta_inputs(dev, in);
> 266 dev_dbg(dev->dev, "action count:%u result:%x\n", out->actions_count,
> 267 ta_sm->pmf_result);
> 268 amd_pmf_apply_policies(dev, out);
> 269 }
> 270
> 271 return 0;
> 272 }
>
> This email is a free service from the Smatch-CI project [smatch.sf.net].
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-06 4:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 7:09 [bug report] platform/x86/amd/pmf: Add support for PMF-TA interaction Dan Carpenter
2026-05-06 4:02 ` Shyam Sundar S K
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox