Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131679; b=zYg0WYPuTyQBuPown6ejTSGKDWQZjsQT2TRUBLDI/Rb3rk2yvsuJdHdRUfZ2G/TCXIPX Sb7gEAWxG1xZUlmBHM4wcwecGZncyzfG6R5IcigRLy0MROlp4NPZGugjIv+vxXdRFAM6L VIuyDtvkKMRiXEaV+265xJrhAwzgR+HAa6IOhPMcSpgFffkynAqpw721HcOnCkgvYX1xa WKjv68yIn800CCp3MByuiAkb1oZSopRZ696ranDKLC0Q2Y0ZzBnp7LZH07itB1yeNnXNm w9Bie8GZRZ8ERnd0DQADbIfsjGzYP2T+V8RKX2P11+ZJ0FBdvXWZDKfhjfk2gvql3Ng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131679; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=6KIZ9eKWp5ixg2vUVV+tEGLfEPfFgs2tzmEJlJIPbQ0=; b=Bsisrkd1+OzfF+ms89xGZ2vGTtmYI+2Ve9MZbHnCY1rG5mRU2RjUqFvp1wLlkjqjZZCI xLV4PX72huxlYwxEczANu1pux7tGSdIPF/aODiFj+sa7njqmZ4C/7u5eMyMoMpNrb8GCM dKtYIiKkGfN9+X7Pse1pwta+cz5g5FO49tHiLJ9t3UVUm28CrGXghtFxnk6x7/ra4ZocJ cdVYhMjqnS/I0xhzs7qXrSiJGGeIGJcNJDpUkc3sfZ8d2MsgPr8XVPKFkOng278ASyyMq ozPlSC24U5UYWSB67AK+o3xZI0CP6tu+8YJMi/kalTO94+Qc1K2AUUTgCkCsavRYpVQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=isVu+Y7p; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13F02606A31A for ; Tue, 1 Dec 2026 13:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=isVu+Y7p Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDEAB1F00898; Tue, 1 Dec 2026 13:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796131678; bh=6KIZ9eKWp5ixg2vUVV+tEGLfEPfFgs2tzmEJlJIPbQ0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=isVu+Y7pxCajQQ41Wn/+T2WN8Dx1A+yKVuFh/NL+gI4/UsrVO4bbdCSPT4SfjfrpE zxL3K5jb1lQcUld8NRu/UJdaFiwesFwmYlINWe3VHqVaIHJRxb2bOytBnuD26XTnMB CfykuTCVi7mPXQVstu4i0pLK7oFIU60MTxDI41o1Af+UMvFoEGV8WQtM09sC2NdjvO /bE6721K7F2uzEpPxlrzFxqZvoVETPOpCMUtx9BPymB9CKr4+PtS7gxPKZI5rNK1ZU WoGVso5+EaxTWNIatBDsT5LLfDC3Ob7TBFkvupLe/mteCKvnES5l2zCFXmtWxDo2L/ yao3WE72crsQw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] soc: qcom: apr: accept packets without payload Reply-To: sashiko-reviews@lists.linux.dev To: "Riccardo Mereu" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261201131537.161860-1-r.mereu.kernel@arduino.cc> References: <20261201131537.161860-1-r.mereu.kernel@arduino.cc> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 13:27:58 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] soc: qcom: apr: uninitialized resp.payload for zero-payload packets -- commit 3dd22a18cdfc965891e87fd5f0f5bbf91090ba36 Author: Riccardo Mereu soc: qcom: apr: accept packets without payload This commit relaxes the packet size check in apr_do_rx_callback() and gpr_do_rx_callback() to allow packets whose total size equals their header size. > diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c > index 5157293747620..55f9b6a4bb76c 100644 > --- a/drivers/soc/qcom/apr.c > +++ b/drivers/soc/qcom/apr.c > @@ -218,7 +218,7 @@ static int apr_do_rx_callback(struct packet_router *a= pr, struct apr_rx_buf *abuf > } > =20 > if (hdr->pkt_size < APR_HDR_SIZE || hdr->pkt_size !=3D len || > - hdr->pkt_size <=3D hdr_size) { > + hdr->pkt_size < hdr_size) { > dev_err(apr->dev, "APR: Wrong packet size\n"); > return -EINVAL; > } > @@ -289,7 +289,7 @@ static int gpr_do_rx_callback(struct packet_router *g= pr, struct apr_rx_buf *abuf > } > =20 > if (hdr->pkt_size < GPR_PKT_HEADER_BYTE_SIZE || hdr->pkt_size !=3D len = || > - hdr->pkt_size <=3D hdr_size * 4) { > + hdr->pkt_size < hdr_size * 4) { > dev_err(gpr->dev, "GPR: Wrong packet size\n"); > return -EINVAL; > } [Severity: Medium] Does allowing zero-payload packets leave resp.payload uninitialized on the stack in both apr_do_rx_callback() and gpr_do_rx_callback()? In both functions, resp is declared on the stack without initialization and resp.payload is only assigned when resp.payload_size > 0: drivers/soc/qcom/apr.c:apr_do_rx_callback() { ... resp.hdr =3D *hdr; resp.payload_size =3D hdr->pkt_size - hdr_size; ... if (resp.payload_size > 0) resp.payload =3D buf + hdr_size; adrv->callback(adev, &resp); } When hdr->pkt_size equals the header size (such as on ASM_DATA_EVENT_RENDERED_EOS), resp.payload_size is 0 and resp.payload holds stack garbage. Service callbacks such as q6asm_stream_callback() and graph_callback() unconditionally read data->payload and pass it to their client callbacks, and other opcode handlers that do not check data->payload_size will dereference an uninitialized pointer instead of NULL. Zero-initializing resp (or setting resp.payload =3D NULL) avoids thi= s. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201131537.1618= 60-1-r.mereu.kernel@arduino.cc?part=3D1