[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221021064453.3341050-1-gregkh@linuxfoundation.org>
Date: Fri, 21 Oct 2022 08:44:53 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-usb@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...nel.org>,
Jakob Koschel <jakobkoschel@...il.com>,
Randy Dunlap <rdunlap@...radead.org>,
Ira Weiny <ira.weiny@...el.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] USB: gadget: dummy_hcd: switch char * to u8 *
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 <balbi@...nel.org>
Cc: Jakob Koschel <jakobkoschel@...il.com>
Cc: Randy Dunlap <rdunlap@...radead.org>
Cc: Ira Weiny <ira.weiny@...el.com>
Reported-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
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);
--
2.38.1
Powered by blists - more mailing lists