From nobody Mon May 25 02:56:17 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78301306B3B for ; Tue, 19 May 2026 02:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779156337; cv=none; b=JJq5eJ2VMuN//DM8jgj5WhH2BpSgNrS/GaINrYJ38es5FSWGZlSOQM5f18G8tGFvZ3Mu3pE2exKJrXKPDfUir2RSntorlmSELYXqPaiVBVU4oUKqqhDi1BAp5ewsevmB6EGoUiFeUXP2piavxjlgmujRVDsOTqg7RhaN8MHa2UM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779156337; c=relaxed/simple; bh=pa0C9yhdgRhLGWznz7JUIUCYN54IH05uEVvyc4UBRSY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=W1G3sPuzww0reArUlaUIrALW3Se7MLglrUyXCZapdO1WLabFCERRiV/g5vPxS7XUVPH5seyPAw4ehUsacmuomlw/24zxKWuyCDEIblTk7ZJ8XB/iKObHTWWYXDx1s5CPgyxXGa/kDQHf/DK+t1Lr35AoyzuQ3HaOfFDZ+V2ZH6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eFwIi0vp; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eFwIi0vp" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2b9ea536877so15885675ad.1 for ; Mon, 18 May 2026 19:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779156335; x=1779761135; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XFGMV7mqlPtrUKnFCz1Two2EamH1z04Y7KnQTcbEHDs=; b=eFwIi0vpLbd3t0XDTdyVSQY6J/2mQPgSf7Q+66fqoyYoo25kdrs4uLpiBZ7YnBGQil ECpfAgHl8VZdBaJQ7LhB6z6kyBQY7I64kljL2BizanLzYHC7bTvoX7xIALz+RGIo7BpR WkdvrAm9wJZDPgTRsb9DD7iJGA4hD9iBpVw00yhrj8P6tgcz4WErudE/DT3TFbsrI5qV FKtwr2i7c27GiGMIzKlcMdjbJbD8ASh6VjTQmVJsDUpN6NAsYt7HDFX9Y9sMgW6/VeJ4 /39pmcQ1pALpslNGVOQhqU0loXj1LTBOJnPq6r85Plq4ffzmPxmmGNeD0bAa3GKzTutz Ajuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779156335; x=1779761135; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XFGMV7mqlPtrUKnFCz1Two2EamH1z04Y7KnQTcbEHDs=; b=DS8mFdFziAzmAlObZnefVtp1pINBssPC8aVBZkqDbw4MDBEBp6lwcfMSdtyXP+9jTX hD7okGI+8NExkS38q8c3hg+IHXonF4Fmuh4UmSQfGI5iMllqESfajunO6XI+pFQoqrEq kJY9ksbDow/qDz+8EYOHw1s1O2R0MBlg98BS5hJkYJaeSPSuFoj9FBC0nwfZ+W3/zYiG epuNAuqV89nOiHzvgLpX9sxYhK2CN78LL4sP6nCi+dnFE57W7+9jmRgtuSG4HcsU2u6o U+W5tm6qQNTYDounAcGtsZTXbexmdJyoemfr+fMjBJJIR05WmMKpTX5K58gkcHlLKUEZ TLqg== X-Forwarded-Encrypted: i=1; AFNElJ/cQk0Ku/dwjNg8yzkG9hS+sCcNXDdiyw4FIxOawjOGx4hm0+4lpYf2W1+lnw5aPbkTK0XeMsOuRrd0dDM=@vger.kernel.org X-Gm-Message-State: AOJu0YyzreUfy/0vE+e5HZn3hVqVfxWZO/e90zvMrGqiDsoZVHCEUF9c sSZGKZOv76hDBVCWKoLioVSuzvwW2MuOqsk/g0m2acIeY5qrFqJoj7IW X-Gm-Gg: Acq92OHA21q3msDT7KmwEoBVpgQWLi6UOY6YfRnmdP2pHnz2Hwo0IiQ69piMCvWcffM uqO4S4ch1jwyuIqURJednhG4su/G4T+xNLr+aIyfHgtEalA6oOmkigBURi0YC9OH6+2/QbCx7MH drYNon4o+UECJ8b79aPSy5YNh6YmA7WHkk3bz1nsBT3Jv6Wy65gWEOntcXzN0A4h2uyadggUdXi XqOLAA0xDxi92uet5uIWPYimIK1hzd0/fFWqgrhTv4DFCFxNC6s5S2S+JjcRTQ/qByTLlDPfASj 2glaIE9tvTf2ws2UeiQVxtmryLx2xVfj/rTPLcphySsHhgIEU0TtBhSt3EZ/wRmDQJn3dy8cbIb LmhZNAYW2MUOJ4VLlhPb5AcdTY+5cw03boVC/D/p2UNQSQTbLJUpct2jqg6za4C3UmsCcXRDeb0 YFd9wynrwzFBnNLRv2SFn/UoOyvlo= X-Received: by 2002:a17:903:388b:b0:2bd:8c03:2efe with SMTP id d9443c01a7336-2bd8c0334f8mr135999395ad.26.1779156334703; Mon, 18 May 2026 19:05:34 -0700 (PDT) Received: from soyboi ([2402:8780:1073:dc10:22f6:2ac0:a51b:5d77]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5cfe7270sm163125925ad.50.2026.05.18.19.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 19:05:34 -0700 (PDT) From: Robertus Diawan Chris To: amirreza.zarrabi@oss.qualcomm.com, jens.wiklander@linaro.org, sumit.garg@kernel.org Cc: linux-arm-msm@vger.kernel.org, op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org, me@brighamcampbell.com Subject: [PATCH v2] tee: qcomtee: add missing va_end in early return qcomtee_object_user_init() Date: Tue, 19 May 2026 09:05:28 +0700 Message-ID: <20260519020528.133623-1-robertusdchris@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: d6e290837e50 ("tee: add Qualcomm TEE driver") Signed-off-by: Robertus Diawan Chris Reviewed-by: Amirreza Zarrabi --- v1 -> v2: - Use "break" statement instead of "goto" statement. There's va_end outside of switch-case, so we only need to go out from switch-case instead of using a label (suggested by Amirreza Zarrabi). - Add "Reviewed-by" tag from Amirreza Zarrabi. v1: https://lore.kernel.org/all/20260513091031.145826-1-robertusdchris@gmail.co= m/ I don't have the device, so I am not sure how to test this change. Thank you. drivers/tee/qcomtee/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tee/qcomtee/core.c b/drivers/tee/qcomtee/core.c index b1cb50e434f0..60fe3b5776e3 100644 --- a/drivers/tee/qcomtee/core.c +++ b/drivers/tee/qcomtee/core.c @@ -306,8 +306,10 @@ int qcomtee_object_user_init(struct qcomtee_object *ob= ject, break; case QCOMTEE_OBJECT_TYPE_CB: object->ops =3D ops; - if (!object->ops->dispatch) - return -EINVAL; + if (!object->ops->dispatch) { + ret =3D -EINVAL; + break; + } =20 /* If failed, "no-name". */ object->name =3D kvasprintf_const(GFP_KERNEL, fmt, ap); base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8 --=20 2.54.0