Skip to contentSkip to conversation

tee: add Qualcomm TEE driver

bug report Dan Carpenter 3 participants 3 messages Sep 18, 2025 – Nov 10, 2025

lore
Share & tools
lore
#0 lore raw

Hello Amirreza Zarrabi,

Commit d6e290837e50 ("tee: add Qualcomm TEE driver") from Sep 11, 2025 (linux-next), leads to the following Smatch static checker warning:

drivers/tee/qcomtee/core.c:104 qcomtee_do_release_qtee_object()
error: uninitialized symbol 'result'.

drivers/tee/qcomtee/core.c

    81 static void qcomtee_do_release_qtee_object(struct work_struct *work)
    82 {
    83         struct qcomtee_object *object;
    84         struct qcomtee *qcomtee;
    85         int ret, result;
    86 
    87         /* RELEASE does not require any argument. */
    88         struct qcomtee_arg args[] = { { .type = QCOMTEE_ARG_TYPE_INV } };
    89 
    90         object = container_of(work, struct qcomtee_object, work);
    91         qcomtee = tee_get_drvdata(object->info.qcomtee_async_ctx->teedev);
    92         /* Get the TEE context used for asynchronous operations. */
    93         qcomtee->oic.ctx = object->info.qcomtee_async_ctx;
    94 
    95         ret = qcomtee_object_do_invoke_internal(&qcomtee->oic, object,
    96                                                 QCOMTEE_MSG_OBJECT_OP_RELEASE,
    97                                                 args, &result);
    98 
    99         /* Is it safe to retry the release? */
    100         if (ret && ret != -ENODEV) {
    101                 queue_work(qcomtee->wq, &object->work);
    102         } else {
    103                 if (ret || result)
--> 104                         pr_err("%s release failed, ret = %d (%x)\n",
    105                                qcomtee_object_name(object), ret, result);
                                                                         ^^^^^^

result could be uninitialized if ret is non-zero.

    106                 qcomtee_qtee_object_free(object);
    107         }
    108 }

regards,
dan carpenter

#1 lore raw

Hi,

Quoted 37 lines · Dan Carpenter

Hello Amirreza Zarrabi,

Commit d6e290837e50 ("tee: add Qualcomm TEE driver") from Sep 11, 2025 (linux-next), leads to the following Smatch static checker warning:

drivers/tee/qcomtee/core.c:104 qcomtee_do_release_qtee_object()
error: uninitialized symbol 'result'.

drivers/tee/qcomtee/core.c

    81 static void qcomtee_do_release_qtee_object(struct work_struct *work)
    82 {
    83         struct qcomtee_object *object;
    84         struct qcomtee *qcomtee;
    85         int ret, result;
    86
    87         /* RELEASE does not require any argument. */
    88         struct qcomtee_arg args[] = { { .type = QCOMTEE_ARG_TYPE_INV } };
    89
    90         object = container_of(work, struct qcomtee_object, work);
    91         qcomtee = tee_get_drvdata(object->info.qcomtee_async_ctx->teedev);
    92         /* Get the TEE context used for asynchronous operations. */
    93         qcomtee->oic.ctx = object->info.qcomtee_async_ctx;
    94
    95         ret = qcomtee_object_do_invoke_internal(&qcomtee->oic, object,
    96                                                 QCOMTEE_MSG_OBJECT_OP_RELEASE,
    97                                                 args, &result);
    98
    99         /* Is it safe to retry the release? */
    100         if (ret && ret != -ENODEV) {
    101                 queue_work(qcomtee->wq, &object->work);
    102         } else {
    103                 if (ret || result)
--> 104                         pr_err("%s release failed, ret = %d (%x)\n",
    105                                qcomtee_object_name(object), ret, result);
                                                                         ^^^^^^
Quoted 1 line

result could be uninitialized if ret is non-zero.

Amir, please address this warning.

Thaks,
Jens

Quoted 7 lines
    106                 qcomtee_qtee_object_free(object);
    107         }
    108 }

regards,
dan carpenter

#2 lore raw

Hi Jens,

Quoted 42 lines · Jens Wiklander

Hi,

Quoted 37 lines · Dan Carpenter

Hello Amirreza Zarrabi,

Commit d6e290837e50 ("tee: add Qualcomm TEE driver") from Sep 11, 2025 (linux-next), leads to the following Smatch static checker warning:

drivers/tee/qcomtee/core.c:104 qcomtee_do_release_qtee_object()
error: uninitialized symbol 'result'.

drivers/tee/qcomtee/core.c

    81 static void qcomtee_do_release_qtee_object(struct work_struct *work)
    82 {
    83         struct qcomtee_object *object;
    84         struct qcomtee *qcomtee;
    85         int ret, result;
    86
    87         /* RELEASE does not require any argument. */
    88         struct qcomtee_arg args[] = { { .type = QCOMTEE_ARG_TYPE_INV } };
    89
    90         object = container_of(work, struct qcomtee_object, work);
    91         qcomtee = tee_get_drvdata(object->info.qcomtee_async_ctx->teedev);
    92         /* Get the TEE context used for asynchronous operations. */
    93         qcomtee->oic.ctx = object->info.qcomtee_async_ctx;
    94
    95         ret = qcomtee_object_do_invoke_internal(&qcomtee->oic, object,
    96                                                 QCOMTEE_MSG_OBJECT_OP_RELEASE,
    97                                                 args, &result);
    98
    99         /* Is it safe to retry the release? */
    100         if (ret && ret != -ENODEV) {
    101                 queue_work(qcomtee->wq, &object->work);
    102         } else {
    103                 if (ret || result)
--> 104                         pr_err("%s release failed, ret = %d (%x)\n",
    105                                qcomtee_object_name(object), ret, result);
                                                                         ^^^^^^
Quoted 1 line

result could be uninitialized if ret is non-zero.

Quoted 2 lines

Amir, please address this warning.

Yes. I'll do it.

Thanks,
Amir

Quoted 10 lines

Thaks,
Jens

Quoted 7 lines
    106                 qcomtee_qtee_object_free(object);
    107         }
    108 }

regards,
dan carpenter