From patchwork Fri Oct 21 06:44:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 6528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp527468wrr; Thu, 20 Oct 2022 23:49:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c4x9N0xCIerBkMok0uezpYSqyz0OG8WlJjPtMvnf4VMVAlCmoA8xXzqki81+EM2ei/1D/ X-Received: by 2002:a05:6402:2706:b0:45d:aaae:e74a with SMTP id y6-20020a056402270600b0045daaaee74amr15536878edd.72.1666334985352; Thu, 20 Oct 2022 23:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666334985; cv=none; d=google.com; s=arc-20160816; b=ZWXpRKQjgcys1oqPSw75cbyw0zW3z52c0oEOBoQyE3szc87W26z0XoBs9+d/GzCdzA UQLwT2pweHkz7RLZ7WHjlEVBqmAWlzkXtBcR9s/6LlZyrOEE4uyOiaAbbcBTItzBje+W yuxZaVeXCLyRM+kAtR/6bnUnM2GXV/vtZgltVHUCA2f8w1yrwbIBsNYr/8K+CC+4ZI3F VLei7r0iyi5fTwidMN+lE9gPyHXtPPAh1RmWHmxvoRCsgUwFS39eOpzFWjccCZoliD3K 1BD+khtQRS18eFN1tuAaVDgjh3wpf2rNDmOZ1e5GvvVQlCTBgcGkoFSUq0aRjlhVxnrv wGCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pAvlnod3xVNuUkD23gdvlySzhpIMs1Zr9/+Iyu6EPdA=; b=R7V7AtFK0nJneVmywD2ggylUSC6sRWnsYbTnQhvoJbMEsRwsNn+tLNJQO2KmS2wKmr 91EDBagMMMHmgzYwUzm4jsd+3ISx8MKXMMrrx+2z5074wFmy4cMp4K9q8VDkSFlqE5Rx YcOIJK8KqOollwzng/qWzGC1djrRlJnU06A/ba66fzYDB0AMwXc77cxaHLYNSsMwhnTI gBIOdW6WbIcg0smBqjv8U1dqqsZWUXVuPk0+VAkLdhR0C5sVuf61G+K6032odiN0ihTe sb3iYq9kGnPWvZuHbL061vu4Z423IymKpI8Lj/CgFC4JjmnsAxV7YKFYLD93TZEgifL/ zaLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CB7H0A4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm5-20020a170907948500b0078cff711da6si7807863ejc.976.2022.10.20.23.49.20; Thu, 20 Oct 2022 23:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CB7H0A4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbiJUGpC (ORCPT + 99 others); Fri, 21 Oct 2022 02:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbiJUGo7 (ORCPT ); Fri, 21 Oct 2022 02:44:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08B608A1F9; Thu, 20 Oct 2022 23:44:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9917061B39; Fri, 21 Oct 2022 06:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82F38C433B5; Fri, 21 Oct 2022 06:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666334697; bh=Lh39dsSR2kSBUfou8Tu7BCiRrPulwLvLeS/qMsODS1s=; h=From:To:Cc:Subject:Date:From; b=CB7H0A4ZiBfH7FVc3Lc7ipzsK2/dBVP4OCKdl8GxWDL86BFWVJUxCZ0ZCfUO+vxej Vri98ayv2EJ5QNqBf40vZatfVuFFA4tqWkFhKmW0Aa4EGCQW7iV0wzHokPugCuobAi E4XmKtRgiLLbtHKesoGq4nkfvF3htpjWobmycpNc= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Felipe Balbi , Jakob Koschel , Randy Dunlap , Ira Weiny , Linus Torvalds Subject: [PATCH] USB: gadget: dummy_hcd: switch char * to u8 * Date: Fri, 21 Oct 2022 08:44:53 +0200 Message-Id: <20221021064453.3341050-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1528; i=gregkh@linuxfoundation.org; h=from:subject; bh=Lh39dsSR2kSBUfou8Tu7BCiRrPulwLvLeS/qMsODS1s=; b=owGbwMvMwCRo6H6F97bub03G02pJDMlB9o/D/S72sPYcWagmYZi1s8eZVSl4z+xKKeu/BztnWzN9 dBPsiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIkYHWeY7//j275+Vaa8Uvbvd983H2 +2CH41j2F+uYPzhicx03i0PRRPyAWItZhGCbMCAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747278873820057781?= X-GMAIL-MSGID: =?utf-8?q?1747278873820057781?= The function handle_control_request() casts the urb buffer to a char *, and then treats it like a unsigned char buffer when assigning data to it. On some architectures, "char" is really signed, so let's just properly set this pointer to a u8 to take away any potential problems as that's what is really wanted here. Cc: Felipe Balbi Cc: Jakob Koschel Cc: Randy Dunlap Cc: Ira Weiny Reported-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/dummy_hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 899ac9f9c279..774781968e55 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -1740,13 +1740,13 @@ static int handle_control_request(struct dummy_hcd *dum_hcd, struct urb *urb, if (setup->bRequestType == Dev_InRequest || setup->bRequestType == Intf_InRequest || setup->bRequestType == Ep_InRequest) { - char *buf; + u8 *buf; /* * device: remote wakeup, selfpowered * interface: nothing * endpoint: halt */ - buf = (char *)urb->transfer_buffer; + buf = urb->transfer_buffer; if (urb->transfer_buffer_length > 0) { if (setup->bRequestType == Ep_InRequest) { ep2 = find_endpoint(dum, w_index);