From patchwork Tue Oct 29 02:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rex Nie X-Patchwork-Id: 13854343 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2117.outbound.protection.outlook.com [40.107.255.117]) (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 BE91E40855; Tue, 29 Oct 2024 02:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.117 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730168326; cv=fail; b=rxiHxd86vVp/2IFeB47j31AZbJ+gtBBSCXgm8KkjJ9zJaZAOvUYGmOf9gz1qmq4yflVdqPcG2Bty2H7pqRpzRpQH1hTlU3Qk6LkBVOWVy7R6T9TPqLupxerfyIgEhQwFC3bPAUBpZHEFPWjQ5HwpkZvsJUGcBXUifebcvoF87cA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730168326; c=relaxed/simple; bh=j4FGRgchj7if3UgZk/+KtrAhOeSTmfkU279jik44/go=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=esds+KXGcnsJIw7uQCAMoVOgZ6bYJr3LxLsuHKVgWgW/baS0wIuDXPFVmF39PssTWBXtusqVuUIlLupEq8TV8oV/QqOg89PgUNGAUbAsROb6BybSp1dTlSVl9jgNJq11+5IdOBqi3mXZOCW59jNCSyhbKIr9RQ4x7Ig8QiWDefI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=jaguarmicro.com; spf=pass smtp.mailfrom=jaguarmicro.com; dkim=pass (2048-bit key) header.d=jaguarmicro.com header.i=@jaguarmicro.com header.b=CkYNiKle; arc=fail smtp.client-ip=40.107.255.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=jaguarmicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jaguarmicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jaguarmicro.com header.i=@jaguarmicro.com header.b="CkYNiKle" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SkxjuU+FKUhbg0IY2VcZdMbrEwGo0+M3ppQ/UrWoepM71/h4l8WO9IAid5IFJ0186I6//oAPmGK/EqLy7LdEMhFN+L7ENY6E6yOSGxD+JBBNHgizxX2oCMfqI7rVLiowkgsansjMp8oeRFr9ffb0AaEaDwENaUfCeI8+cCBpA7cRej9sJbRcMqnDkGAW3Z4x1a6xtgbtTTKeIzCfQEjl+43YHC0J7lXYTTlzEolzn5cKooHC6Vfo8xl9bMCdDcu3OhxqFmZNgRym0dHQOYdxdKQ4CvQEfFtx4ztuajATfOOCmlcJmSsf1X3rFDTNWW6lw0SKuu90CD2wa1o/pKTieQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I6NDFIj0G/oDeo/VBHs364mgkaOeMo7ynN5Yngwd9tQ=; b=feWRp6IV9zcJwmtoyjMRbYtiJ+aAgqrzUQA3TqukavVZ6x7+T431C51GCQjcT0RM6jWNk0vsehNtp270sYF17Lh8gKWrzhsdAAwokcP39FksHKe2Cjcs2ST++GVimDEfbOfD/6Yieu5CjsSSGpfHE4GMXz1ehPCzqovnqKWqMDjLKrTrCwwDkHVFMZfSxxfznZd2YdJbE/qXnb63DmB3beT7JLcu3H8fZzBkmrPYEswpFLEB8yuNin+VM9YzfZoIr/g+XgvarlooDOQ9JKAVrBo9Gghvbm65gEXhQTZllIucgAfgv1SvVZ0KVnalmmjiDKWw8xwQ8XWC7VsZ3/3C6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I6NDFIj0G/oDeo/VBHs364mgkaOeMo7ynN5Yngwd9tQ=; b=CkYNiKleC0Lto5usGBj72D/4GwiwY2T0noBPxZRd2i/3xDB6Ufoe0SEcPNOK0t6E2n3vyz1/q2oNqhwt4RUzD5xJp6pOhamxLlLBZnLT6RJiO1q87Isg9E1dkN/quCS26PKaMq7z6bUC0xc1o7kpzG62vxJCrGagDjgYKIriMBJW/AoDIwbdq54gTtoGxhwnrtXxqh12xMavaLsMOmR37zmpLk/Z6KL+47CPJxCzm7KCNI3ItW7ympR3fdyAX7wnPVkUxUifzZXW06xZ6zvmuv/3O1mo3XLT8tjCa4D/nUBaDkeS8OBZZdsSEK8NshsF9Jm9yFdLWbsuo5nwIYnjxQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from KL1PR0601MB5773.apcprd06.prod.outlook.com (2603:1096:820:b1::13) by TYUPR06MB6193.apcprd06.prod.outlook.com (2603:1096:400:351::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Tue, 29 Oct 2024 02:18:30 +0000 Received: from KL1PR0601MB5773.apcprd06.prod.outlook.com ([fe80::b56a:3ef:aa9d:c82]) by KL1PR0601MB5773.apcprd06.prod.outlook.com ([fe80::b56a:3ef:aa9d:c82%4]) with mapi id 15.20.8114.012; Tue, 29 Oct 2024 02:18:29 +0000 From: Rex Nie To: bryan.odonoghue@linaro.org, heikki.krogerus@linux.intel.com Cc: gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, angus.chen@jaguarmicro.com, Rex Nie Subject: [PATCH] usb: typec: qcom-pmic: fix uninitialized value hdr_len and txbuf_len Date: Tue, 29 Oct 2024 10:18:23 +0800 Message-Id: <20241029021823.1978-1-rex.nie@jaguarmicro.com> X-Mailer: git-send-email 2.39.0.windows.2 X-ClientProxiedBy: SI2PR04CA0004.apcprd04.prod.outlook.com (2603:1096:4:197::22) To KL1PR0601MB5773.apcprd06.prod.outlook.com (2603:1096:820:b1::13) Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5773:EE_|TYUPR06MB6193:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ab0ef60-e7ec-4c35-0544-08dcf7bffaa4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: T76DSg8rLgLYvZt++Rq/7AxGNlAaHTTsV6WosrEyNIVCqoJYp0aMFK7v3TJqKxfqIPde+fxwVxf1nvHbFI5KZ/vtRQwVxOLdRNtGu+sGBX12lna3f4VH2h9vhNQ7LegpRwwRHArtReWNzJf6Rls7ONs5MX1DZJHsAMiqD5X5rC4jVEz3DrC+CeuR/j6xjxFRw8hgki00LD6XL/jDELsywAPyVxR3oUbk2lu41uXEBF0Fl55/bmcJ6xPBp1/OkbmgwEgjF6it1ltc5jmwLnOgT7aLqaZtCCt+yldlwsmpkBKh10I+jzgro4rMc414u06BRLqnY534RZovI3uODYXUTBzaKt1TC0fYWPeBrDG1OCYa9XjPBqCxk6wUwy1KFsogqS9OEzh8lxZIeFmRe9h91r+ENN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;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FRA+XvvTntn1yg90w5H0Ox6zJsO/Y+isy0yJpmJLuhOJvf3VohT1KqM7cI+p7EuBloMqfRqXqV9pXbSwhtNTMh1khR/QL27JnmU97HPiGo7yyvLd8N2lYGEt9a0onUfcg5wgG3Zz2CsCMsCktA5o1KMDwDZThuUvYygfjmyQQi5psroWYbcwyTXXmIOFLTda9qy6xqtju0ZPYrdv1Dris2T6Ux29x3Vmi0QzbRxPPie1YOXeYBDqGqBzvQpLFV+BysgICkFxBQGmpGQEkvQOcWlTXOa2ZxjKjRo6ulCTCGUCy8SSmt7aT2gglDSpwjkQrOzr4F4YF5nfqqtxnPXlNzkPIxrUt0CjL9CCgECTiHgUgFgRD/sC2YP1OWwGi3MgiP9dcxicMfKg5z+ZhtbZSkaU6W3qOCJjMmKKBqjnX0MHNEsXt+G5ayuIRBmw3oCAys0o15mnn0gC9srrYos3S4gN3ViTv12ZzVxJTKsPHpg6+BMjS+DgqFkMuRuAl+HA0KElKN9mdyThkO1nvy+5FILFdbgy0tDECuAgrid1hvjrPTd/aGfu7LtNHEocq4/BNPYgJ6Tpic0w8hKnjOJ5N3AmjpBniuxGJIsbVSWZLzVe7TvOIvlqdrB461Izr+7Yyf5kApfwHDBbcvzfpxX/9QKOagBRi6/IcVdbGvrysYvmfqSw380rkZU+RPS47C0lEnPf1Y1oNNISSQH+Mxz+7Saf/Ptt+bDSWRT/hJn1mOM7V6y5/dVYhwiu7xS6toX7U/Ihpi3BEOAhItkZJT10CvR0WbMDzgGLmcNo0N3jdrKO1AN03LUOs4x9L4HYWDDMX/0JmIGcOaO/GRdPew/3jAsP18jWskddBIQ2mUIIvMMF2X8klHMM48hHhIYmCzZz9ncmh7pV0QRK+krzdQujHupecTR6vOYCRvPSCa4XcDzP/wakmC/a4H89inppC1wqYFPE7vo0EN6YLsi1ViHQ6uO9rZyAfUkct8oOLSN0wn21ps0tFlfzEfC1SQuW42mef5zfaSeb9DwbT2ZsCVYsvrvSiRvrNS6RGnvNbZlBVJbedFH/1dk+aVM3LZnBtl8xAomLzUVzuEvuZLV8tB++mXQXGkMumMldO86mfm1IzQSgNjw1FZfbDCWFYYNn1k44ZrSS57iVPwyU/zaQYS+t1ik1q/VaXQg31dYUfv9Jfb4sblLWQarP6trZyR/5n0yZlVtUN9urQGHdfxrjJq3z9479uQWgznjgE/21RKtA9uIsSn+Y+qnOsVnq1xstUObmqmEuK3c0SIvf3hc4PZx5Oc2dP2zaN9yoyjY05fcGjQUyLIs0sah/1R8SMbS3V+8LWES5Fd+sBsvc8t9JxyvfrJeWc8UKrDgaCL2Z+bzbKWLpLe/qd4P0Q28KyI3ZuPYiDN4ZnqBV5TgmPJeb28Kwq2gpxbuOoAe/c6NMhfXFOlAX0rtDqdrLmKtsNDcCn38ip8Y5Q3JdmOKd08QjoUuM9p0eyWt+9goin9uPhE1+UT0UqTwnA7rkBXSmKkcYgZ+tQRckPzACWo5dk1BmNNcZ6xwUB4OG0Shu18CH8Y4/1jWuToCy/ATse6+WEhG83QlMh46bfIMqMIogNmMDghAn9g== X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ab0ef60-e7ec-4c35-0544-08dcf7bffaa4 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB5773.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 02:18:29.8337 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FL8XeiWTOlu2ySkzbWXexKWxfXJbMPNaSHZoKVln47PeQmjCDDYFLO4ICJyGylwz7LrHEI2tM6AT+/6RHjhtlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR06MB6193 If the read of USB_PDPHY_RX_ACKNOWLEDGE_REG failed, then hdr_len and txbuf_len are uninitialized. It makes no sense to print message header and payload. It is also not safe to print uninitialized length of ram. Signed-off-by: Rex Nie --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c index 5b7f52b74a40..53c2180a773a 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c @@ -221,7 +221,7 @@ qcom_pmic_typec_pdphy_pd_transmit_payload(struct pmic_typec_pdphy *pmic_typec_pd unsigned int negotiated_rev) { struct device *dev = pmic_typec_pdphy->dev; - unsigned int val, hdr_len, txbuf_len, txsize_len; + unsigned int val, hdr_len = 0, txbuf_len = 0, txsize_len; unsigned long flags; int ret;