From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69BDB30DD1F for ; Thu, 19 Feb 2026 21:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771536342; cv=none; b=BnIqF7YFTZyGNU2UBFo2gA7n/5jzH6YW/etQNpUS48LQpDL4sD+FDJRQ50xuQeXSlKSmteQIRDNix9cgX6fD8s4q9Yg8jFyrUN9epPmFREN1++bjlPuVDBHOUzAxaN63R/4HjGChqsab4x0HDPpxYgOrc7q3nE8jx2Er7RxYT80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771536342; c=relaxed/simple; bh=jL5o7GFTmugEcXq2ui02VPU/1+FwYLCcWIC8F9vnZHU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=C1fKw61yayywLw4ImyXDspIu/DD7fvTjqCpdaac8PbdIoPTItY54OV3YAHvDnmVAJpXT0x4hl5MsWvlnWzcIVHF7bvVCkRLZqm1xeRiRyUsjobhAqNxw8Z50VIMF2mj8kAsSo6xeIPcYekE99JCeHrnKluE+6U2JVyEH4+mjgkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=CcgqruqB; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jdWbcu/e; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="CcgqruqB"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jdWbcu/e" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61JJAOCi1288554 for ; Thu, 19 Feb 2026 21:25:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= kB8rK2ZPQwwyuY/8mrVa4LKU+9IjuHU85pf2Pkg6JGM=; b=CcgqruqBhDF4DmBj U961qpivyYUC4c43YJ87fzFdzJW/K4UcXFTfVdt350VDvcbStDpQE8v9Bq8E97AU wG9QrsBdU0h5/NdvJpUtwMsIEr20Z8htOFPYMIG8G8/VsyNiy2LKwYPFtJpZuZw/ wGePOG7pwsBNpkoO1UHCUr3LOqipjap3vaeRQhVEb6ihuLjGF9bnek4Y4w8K+UTB xxJzB3CzbA2CEPiVmX6MFM1KUaWmkfaOLQVdeVk6Smu1jBAHy4Nut0IUJ/jeGJUY +IulmCQByThQGD0jrtOOs79jpiD9+WVz5aioZRJk4BoeqSdYIs3cUmqtQWTH3pXh 81KbLw== Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cdrpgb1gx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Feb 2026 21:25:39 +0000 (GMT) Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-127133794b6so879579c88.1 for ; Thu, 19 Feb 2026 13:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771536339; x=1772141139; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kB8rK2ZPQwwyuY/8mrVa4LKU+9IjuHU85pf2Pkg6JGM=; b=jdWbcu/erJIA1ztZ+Rzxs/wLT2mphpbRWEUu87XT0L8DxAh0Hx7UA3znvmMnmPSWXh KUroDQKSQoqXoytk7BouPEDOaled3xEhkw9umBVceIZarhqDZwHx+V1eNamdo5sQnLoL YQjn1eIZ9rdCokQLF6f2Nm6ygpLL2+fE11KwlgE799goUmDAuDW86zeYOLDKvm1iAaNS KgIPEWU4AZ28d3zswXnGAo7EPirfyI6Gjzl3qtzdNPg7kSxmb3Nv/7Ot/a4VbUx8L/Ky 6cqmcjYnOSlpnhLI7+iCU8BxSzVLcmOkfMaSOkpBNmbH3vGqjXFWrowC2Ln5rIbNpcfb 7//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771536339; x=1772141139; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kB8rK2ZPQwwyuY/8mrVa4LKU+9IjuHU85pf2Pkg6JGM=; b=kksOyl0vQRr91YPX2rJAjzOoOKtCw7N3ak639RdF0TN4NkEskZoQ9nAQcPm1IuWVGl fFlISAGYhzPfFTKk5s7/fhP9TMpQLkA8tlbT287IN9uD0EZJzluDj/o72T5KeHbRe+9F xnJxcYJlqZ9Go05EELvobsZXgfeBnxZ+BZFeWkzE4p7cauUH58uQKuYTS6WAd12gtg+b 7SyGVuCM3sah1us1agw/cXhKuXI8Q2Vf+WEN2xfiP9dme6Xc6d7VVyK5sW9qBgm+stw7 NkULkTVMBMWXxoIg9E33Ziti9MUsFaMT1R23laBnm5u/BCuBXvrlmQQu/bfo4XFeRQ/2 alZA== X-Forwarded-Encrypted: i=1; AJvYcCUtZQ8XUPLQsAZ4mgqIo2Ui/KYwLKNwFYSqJ4sHuLyK+1xo4VGjuQ7IB4hHbcBzZDmOICS26gGdIIzjOl4=@vger.kernel.org X-Gm-Message-State: AOJu0YwpN1rP4NSgAcCDJxBxZs/vZaSe4Ci6fC1ScLj0H5xORgRsHbqJ Km/27mFr8XmDGnOkizr0FEpJ9cRsx0O/ojp2QJj4zE/Zcpjab4+ffuVT3U8XzhIL9KGcGs/Uzog j6dp7qY/QCrN8dLogsUccvUVFLm3JzSjnBnZGkbqE6/z08BzhYF9HiiCPG0jpNC7gZk4= X-Gm-Gg: AZuq6aKCiu8vW/Zrwk7oEGUh5miy3GXX09VIFgJgg3zMNK5q7THzLjgXOGsAZ90E2I0 s0U8/5SPul5qJu31FPqxWL30rODGCymV4NMuiPbICR0rb8imayMpgGVHC+xWC5ghDBa6xNAY06N b4qHRcQo5ryBBP1uNwi83OlWULSr3U4JocQiTrFXaMPgeGw5QUUEz/0+MwRkcul713qR3hTlmpA dgIRT/RzXVBgzZTbio3vY420OvS4+cOgtW+4R5SysQwp2s6+jQoij8DdwCKttd/C6tC2+uhcxht 0Izw+SccDWJ+H2h35RuE+Ekab+fL+2FF3m/YfextBidRq/rcIFOvSeY7MG8Y6mf7uhWefDpilIY de6FWL9lqr0CEltiU3Gp2OgmIb4TohOMDlpLLIfB/3pEwRTalM3ywjMAvgZFVjYqQQTurGmwzYp uhgD86+TWdfu0KVQ== X-Received: by 2002:a05:7022:2510:b0:124:9acd:3bd0 with SMTP id a92af1059eb24-12739790159mr10632451c88.5.1771536338951; Thu, 19 Feb 2026 13:25:38 -0800 (PST) X-Received: by 2002:a05:7022:2510:b0:124:9acd:3bd0 with SMTP id a92af1059eb24-12739790159mr10632432c88.5.1771536338383; Thu, 19 Feb 2026 13:25:38 -0800 (PST) Received: from [192.168.1.41] (c-24-130-122-79.hsd1.ca.comcast.net. [24.130.122.79]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12742c6430asm24324381c88.6.2026.02.19.13.25.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Feb 2026 13:25:37 -0800 (PST) Message-ID: <1ad37b2f-5f3c-493e-ba3c-fec1a0377767@oss.qualcomm.com> Date: Thu, 19 Feb 2026 13:25:36 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] soc: qcom: qmi: Fix "invalid data length" in encoder To: Bjorn Andersson Cc: Alexander Wilhelm , Chris Lew , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, David Heidelberg , Jeff Johnson , ath11k@lists.infradead.org, ath12k@lists.infradead.org References: <20260214-qmi-encode-invalid-length-v1-0-780cb4e98b0f@oss.qualcomm.com> <20260214-qmi-encode-invalid-length-v1-1-780cb4e98b0f@oss.qualcomm.com> <608ff2a7-775e-46ae-ba8b-9d9c2f8219bc@oss.qualcomm.com> From: Jeff Johnson Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: 9tHXzNsuGGPiFaoHbTZYS7TiUJ6F_tTv X-Authority-Analysis: v=2.4 cv=JrL8bc4C c=1 sm=1 tr=0 ts=69977fd3 cx=c_pps a=JYo30EpNSr/tUYqK9jHPoA==:117 a=Tg7Z00WN3eLgNEO9NLUKUQ==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=NEAV23lmAAAA:8 a=btePvF4m8IT5Eud_TlQA:9 a=QEXdDO2ut3YA:10 a=Fk4IpSoW4aLDllm1B1p-:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjE5MDE5NCBTYWx0ZWRfX5tcfkHlWLao4 zJC/Eo7k1sj0qQp0S4pLsOh96BpSqtmtPD7Whwt7Id9GYmrnFKF5Hmwj2WACuEIwR/J1JoXFwWp 2K0p2q1SoIwtYAWxWyWF2yqEDbcLPvvZMqIY0phNEh/gkbu6Iw4qj1wbvJKHWYJnJwb60VsY03v GCF8WNUerjqtPUVSVy7COHMImtxSrUVHW/+/kYEgy4YrWLpImoL9i8Woctpl1zIxEZvgsECdvCZ z5243mUjUt1Q3pT33kkpBR8mlLUBIzgMReFYrnxO5+wmfN3gvN+hE36PiI/Kzi5IEkEo5xKdifw jqXTt3JEFP+kNdvl0C2V5OuHybm3j7tLXBnugPwU1YAD6+XiPFRhpyYr8jiogMgMDUlnOIrbqLw 8vMa1/mANeoW8RkIgFw9H8F9RchvNQXeNZLeEP7+XbghKK8ffJHLXRuhuX+lhY159DWiWN33f6I 62+UH8B4KHEosxFbAiQ== X-Proofpoint-ORIG-GUID: 9tHXzNsuGGPiFaoHbTZYS7TiUJ6F_tTv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-19_05,2026-02-19_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 phishscore=0 bulkscore=0 clxscore=1015 spamscore=0 adultscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602190194 On 2/19/2026 11:18 AM, Bjorn Andersson wrote: > I reviewed the downstream code generator source and documentation. > > We do generate tables matching the ath12k c-structures, i.e. variable > length arrays are always prefixed with an uint32_t field - not a > uint8_t or uint16_t based on elem_size. > > Looking back at the original implementation of the in-kernel > qmi_encode(), we only read elem_size bytes from the c-structure, but we > do so into the (little-endian) uint32_t on the stack, from which we > encode the message and act upon the result. > > In qmi_decode() we decode elem_size bytes from the message into the > (little endian) uint32_t and then write 4 bytes to the c-structure. > > > The fix would as such seem to be to just update the length fields to be > all uint32_t. The problem I see with this is that qmic [1] is the only > publicly available code generator, and if we change it to always > generate uint32_t length members, we also need to fix the > encoder/decoder in libqrtr [2] - which will be an ABI breaking change. And IMO that is a deal breaker since it would break the interface with all existing legacy firmware. > > If we go the other way around, the drawback is that we no longer support > the c-structures generated by the proprietary code generator. > > Worth pointing out is that the structure of the c-code is an ABI between > the encoder/decoder, the code generator and the client - it does not > affect the wire format. > > [1] https://github.com/linux-msm/qmic > [2] https://github.com/linux-msm/qrtr Going back to the original implementation that reads and writes a u32 on the stack, can we stick with that but add endian logic that correctly converts between u32 host endian on the stack and either u8 or u16 little endian in the messages? Is this specific to QMI_DATA_LEN TLVs? /jeff