mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
tee: qcomtee: add missing va_end in early return qcomtee_object_user_init()
qcomtee_object_user_init() is a variadic function and when the function
return because there's no dispatch callback in QCOMTEE_OBJECT_TYPE_CB
case, there's no va_end to cleanup "ap" object initialized by va_start
and that can cause undefined behavior. So make sure to use va_end before
returning the error code when there's no dispatch callback.
This is reported by Coverity Scan as "Missing varargs init or cleanup".
Fixes: d6e290837e ("tee: add Qualcomm TEE driver")
Signed-off-by: Robertus Diawan Chris <robertusdchris@gmail.com>
Reviewed-by: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
This commit is contained in:
parent
028ef9c96e
commit
471c18323d
|
|
@ -306,8 +306,10 @@ int qcomtee_object_user_init(struct qcomtee_object *object,
|
|||
break;
|
||||
case QCOMTEE_OBJECT_TYPE_CB:
|
||||
object->ops = ops;
|
||||
if (!object->ops->dispatch)
|
||||
return -EINVAL;
|
||||
if (!object->ops->dispatch) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If failed, "no-name". */
|
||||
object->name = kvasprintf_const(GFP_KERNEL, fmt, ap);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user