Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1593580rdb; Thu, 7 Dec 2023 03:52:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFz+7wzyiajlPF0hfFctwpfBhi/qubWry7oVQbO/82tOFkvHBM0xMOj7mRPU9I8YfPBOnD9 X-Received: by 2002:a05:6a00:3317:b0:6ce:4047:7a6b with SMTP id cq23-20020a056a00331700b006ce40477a6bmr2905899pfb.28.1701949924934; Thu, 07 Dec 2023 03:52:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701949924; cv=pass; d=google.com; s=arc-20160816; b=Mitk8WAqT6SY14LqmLrKhFwts4WDZYUt7yFBomXEFuikYzciswuMNrPVo9jDFP9L8I VzHEa3qDOFDeDVkYDzPYxH38A2BP7osiM87jKd8g5SaA9xst5lgqkbao7H/d5Z38fFM9 2dAp4TIx7tpNamwzCDUslK/9Vm7kdPOmPDAML1WV+3QpeGlh+KPqLoCv5vx4gBuCDyx+ MSz77KTeLB5G5fe0ksFxwPGj6gp3bTUTl78gxy5V6FH/R1tbu/0br11pRwuXYLFYnceF 9N6R3WF41u3IkB1fXmG7jX+Lc9VECuacVB+q4BDARn9Z8xcgVygUXRvhoVgqveR7CRRa lt4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:in-reply-to:references :message-id:content-transfer-encoding:subject:date:from :dkim-signature; bh=qmn+xRnKSGtQIicZhyD/lr/8Jjsxgyoot2OSa2cnruQ=; fh=skg4aWcIne/NkBvGBSxiPFt6u1LkY77F5jj9Umi9ZmE=; b=i/k4MaQQ/OQFy0DzobtqDTXyno6HmdQLrVyPUC3tA6Uwo32rbTondG4JJ4QV/NX71v 3tj+rwoX3AAoVgk9dUQqyNHP6fj8+cT5TqduIQYqmv7ULYQBLa3PkXeYJeeZWK34sRMK 1IiGNT+gJpZ7VU0xG8LmY2x2r3OJcuYShprwqKP0mpmgjqBU+Sk+44fhUboCUR68OdnG cVNpjzoEYwTYdE1thj5ZEespyjPqkTq+guDx49D5ADrS5NgxZ/5Y1rGpAybF4oyO6lAR 1zqKzXlOcF9tZ/sfj1KmyF96KuCAcAomFep7K02FCVXW2b/YhFclz31bzgD005toNXUj u03w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=SWqaKI4A; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j5-20020a056a00234500b006ce51b7827esi1132620pfj.294.2023.12.07.03.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:52:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=SWqaKI4A; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 805A9809D3F0; Thu, 7 Dec 2023 03:51:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379143AbjLGLvY (ORCPT + 99 others); Thu, 7 Dec 2023 06:51:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379007AbjLGLvP (ORCPT ); Thu, 7 Dec 2023 06:51:15 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908C019A; Thu, 7 Dec 2023 03:51:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=izb0lvQ/x/16ob626iW1DDuFCJ6gC3jjY20/ziRuXC9JsHszDTbwk8b98SojWFr8yw0DbaoHqC675MeZmGuQ0jc8HZ7IKH0q/iSaGkV9TwW/98twxcFeoSwCdEtJAPdIF1w6Nnha2RcpsbSKrNTUGfjUsXVCw0FszfyMInK4nfYuULz/65FOl0gqe2CmZY6fgTPJK/LK6X5u92PDsuYVcSOHKQG1/gHq+N/79yNdefigaZf2MkZQIB0B8ZcGHUjuewEAB8hQHw9WhBz/i9d9HT3zQxH5C0RQppbJM3SGxIFjgQTAXWUJLYv8I9EOQjcmLuZEMTTXz5Oj3q6/xR7e4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=qmn+xRnKSGtQIicZhyD/lr/8Jjsxgyoot2OSa2cnruQ=; b=gG5riPDyroX9S90X+3MhxuNb64ukEfx8q8GOdFAt2qSGExzFzpDFeHNpnWzrNmouoWXvNxWW2Y2KwVwYF68IUZZRaU1NkbFNeFJkmli9q6Na/pnQ408ZSszN7l7xoKMG6V2o4jQEtq/WgDK2OKGMfnOXZM4B61gpBZKYI7Je0VziDJ1lmtcSL3Zt/pjFMk7bKYZ1lu9VruHTwKCv9ERe+qVE4VGC1OoBd8oWuviyxEynDA41MLAAes+C8dHNaRD68Kausjs4LFAqvvVZh/+vFUvJLGoKPvVFMTvzknbUsXmNYcquyYHVfub5FC0N20OtPpox6HEvMDj8Ws0z4sKq1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qmn+xRnKSGtQIicZhyD/lr/8Jjsxgyoot2OSa2cnruQ=; b=SWqaKI4APJMe2JmHdK8jhA1IVlljxYbK1HHPQu21RkCTr97ltyd9MWqBin1ooZTRUEvfUqlNgvPBF0/jd0vLRe19iK9tHbexBPJ+vVThN0wSx0JGYGm66OtB+IebLEIv8a/BRwqMFuNuy+ZWEJb0rbVVQNGOo9KxGMPULRhirA0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DB4PR08MB8054.eurprd08.prod.outlook.com (2603:10a6:10:389::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Thu, 7 Dec 2023 11:51:17 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7068.027; Thu, 7 Dec 2023 11:51:17 +0000 From: Javier Carrasco Date: Thu, 07 Dec 2023 12:51:08 +0100 Subject: [PATCH 3/4] usb: typec: tipd: declare in_data in as const in exec_cmd functions Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231207-tps6598x_update-v1-3-dc21b5301d91@wolfvision.net> References: <20231207-tps6598x_update-v1-0-dc21b5301d91@wolfvision.net> In-Reply-To: <20231207-tps6598x_update-v1-0-dc21b5301d91@wolfvision.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701949872; l=1739; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=EYKG2QkBt3Q9Z4VdE6eA++VrFA30t1cRvwGmQo1q76g=; b=5JVDfkXVegF6CIN4hukYujw0bL4v5DcLfO+MTuIQgMQM8NdRzJgWnpIyTFqr7w2OKq1yhPWNf yCM6XD8543ZB1Z30xxCSKbWvelha1z50OHjHLVftXVxsSobrC2mmpFo X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR08CA0248.eurprd08.prod.outlook.com (2603:10a6:803:dc::21) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB4PR08MB8054:EE_ X-MS-Office365-Filtering-Correlation-Id: 11f2c7ea-5d21-4527-75fc-08dbf71ad075 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3fPf7PXstu/u5jGuW1bUcprz7uXc11inOwCt6yXMcDsdYqfiP3ERMxJ6fy7LGm9RrcSlhbb9ByWFW8mDLUYElwA2Yo95nNv92kVqB9yfhofQ/sM8wIuhbY/wPcNTdqTyU/EnA+uJsG/d4FPqh1563vVPlHqixfDpZx6jMm96JGPS8u/S7QWMCj47t6BTQ1SuNRALs6tk/NApE6slidZmw84PrM0ye9n7Baz18Qv/YjxzOU78Wyd1no+EHTx0ZVi6tVAmJYGi/JwgNYiCm7YPDgNavjSA5vVMVpx+TQ6CSoGXTChoK5sbC+lG5SLiAolwunxXUdA1afa7Tybf+z9ml3UgneRLzebh8zh6Q4ecMWw5z9ZK7Sm50ICRN+VlcHi9T1822CbTIsleS5e1MBbV9sAFYsByQ7TJK2w/pjlvtvVneQZMfA76V4ZxMLSVWL0IQuHYvYDM3eXOXxXnABL+iXOy3nOOPeuah0QQGlOF4QQCO/ZXkvnGX/V1wmSyPrxHVACw9jHKX+Aue0mJHG5kBvvffFU9SH8neblWsMZn3waMckzQmUMveD/wLUHQPWAu9eYo5QinUg+5u65RUNh7k+6vG4BYGb7AuKfIwEvRpMHpcVptN04eRtO/eAj0+uGb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39840400004)(136003)(396003)(376002)(366004)(346002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(52116002)(38100700002)(5660300002)(38350700005)(2906002)(2616005)(6512007)(83380400001)(6666004)(6506007)(107886003)(26005)(110136005)(36756003)(6486002)(478600001)(41300700001)(44832011)(66946007)(66556008)(66476007)(86362001)(8936002)(4326008)(316002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UzV4UDZXMTQvaC9pY3laakRZUFRRVDk4QTJLMnpZQ09uMS9NYWhoejUxVk5C?= =?utf-8?B?UGhDbnRQUmU5RlordDhDTjlWcTR2T2RMc0lRS3c0WXpiVlhibTR1STl1elBP?= =?utf-8?B?ayszN1hOclFjWWFPY2JZRWR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Q5NzZjakJ6WFNpU0Nu?= =?utf-8?B?YndLc2VHaUxFbE02UnZoc0pLUGFjVjlHUkNGWXgweTBjYXd2UHdkcXJkazh5?= =?utf-8?B?Q1hqTEs1Qk1nM1BFbGNiZHAvVHlzVDFTZjNxSUJQWlZJTTJKeFFOREgxUUls?= =?utf-8?B?M3lydEdGb3JMbGd0UXVXcEVLVUtPVGl3Mkl4clMzY2psQlNOVjJPVXVRQkdh?= =?utf-8?B?aWhyL0o1bnIyeUtkWEN6T0N2ZXBQR09tVjZZMkZkKzl3c3lGNHJGTGpsQUhO?= =?utf-8?Q?SGr01Nvfdu/8ceWMh2l8WQo=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 11f2c7ea-5d21-4527-75fc-08dbf71ad075 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2023 11:51:14.2591 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CpetL/K0PjQMRcgRwfRIqXkiRY7NvVzsiee9iNsmikvlenkpzmW/ggJxFVfgMAujR71M+gsomYXMMj19slePBiJpAYNrFR9RYO/ng/5Faug= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8054 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:51:50 -0800 (PST) The input data passed to execute commands with tps6598x_exec_cmd() is not supposed to be modified by the function. Moreover, this data is passed to tps6598x_exec_cmd_tmo() and finally to tps6598x_block_write(), which expects a const pointer. The current implementation does not produce any bugs, but it discards const qualifiers from the pointers passed as arguments. This leads to compile issues if 'discarded-qualifiers' is active and a const pointer is passed to the function, which is the case if data from a firmware structure is passed to execute update commands. Adding the const modifier to in_data prevents such issues and provides code consistency. Signed-off-by: Javier Carrasco --- drivers/usb/typec/tipd/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 165a1391dc72..cd5214c9799e 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -330,7 +330,7 @@ static void tps6598x_disconnect(struct tps6598x *tps, u32 status) } static int tps6598x_exec_cmd_tmo(struct tps6598x *tps, const char *cmd, - size_t in_len, u8 *in_data, + size_t in_len, const u8 *in_data, size_t out_len, u8 *out_data, u32 cmd_timeout_ms, u32 res_delay_ms) { @@ -396,7 +396,7 @@ static int tps6598x_exec_cmd_tmo(struct tps6598x *tps, const char *cmd, } static int tps6598x_exec_cmd(struct tps6598x *tps, const char *cmd, - size_t in_len, u8 *in_data, + size_t in_len, const u8 *in_data, size_t out_len, u8 *out_data) { return tps6598x_exec_cmd_tmo(tps, cmd, in_len, in_data, -- 2.39.2