[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wggc19mf+WR=eg7h7MfVVNbE1c8b5vcOc6wmDASNTMddg@mail.gmail.com>
Date: Fri, 21 Oct 2022 10:30:37 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Felipe Balbi <balbi@...nel.org>,
Jakob Koschel <jakobkoschel@...il.com>,
Randy Dunlap <rdunlap@...radead.org>,
Ira Weiny <ira.weiny@...el.com>
Subject: Re: [PATCH] USB: gadget: dummy_hcd: switch char * to u8 *
On Thu, Oct 20, 2022 at 11:44 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> 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.
I think you might as well also remove the cast that was always a bit odd:
buf[0] = (u8)dum->devstatus;
although maybe it's intentional ("look, ma, I'm truncating this
value") because 'devstatus' is a 'u16' type?
I suspect a comment would be more readable than an odd cast that
doesn't actually change anything (since the assignment does it
anyway).
Or maybe people wrote it that way on purpose, and used that variable
name on purpose.
Because 'dum' is Swedish for 'stupid', and maybe there's a coded
message in that driver?
Linus
Powered by blists - more mailing lists