[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9qQAqXYR0+K=32otECgrni51Z0c38iO3h1VRM4Xf3o2=Q@mail.gmail.com>
Date: Tue, 18 Oct 2022 14:58:30 -0600
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Stanislaw Gruszka <stf_xl@...pl>,
Helmut Schaa <helmut.schaa@...glemail.com>,
Kalle Valo <kvalo@...nel.org>
Subject: Re: [PATCH] wifi: rt2x00: use explicitly signed type for clamping
On Tue, Oct 18, 2022 at 2:57 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Tue, Oct 18, 2022 at 02:52:43PM -0600, Jason A. Donenfeld wrote:
> > On Tue, Oct 18, 2022 at 11:40:54PM +0300, Andy Shevchenko wrote:
> > > On Tue, Oct 18, 2022 at 02:27:34PM -0600, Jason A. Donenfeld wrote:
> > > > On some platforms, `char` is unsigned, which makes casting -7 to char
> > > > overflow, which in turn makes the clamping operation bogus. Instead,
> > > > deal with an explicit `s8` type, so that the comparison is always
> > > > signed, and return an s8 result from the function as well. Note that
> > > > this function's result is assigned to a `short`, which is always signed.
> > >
> > > Why not to use short? See my patch I just sent.
> >
> > Trying to have the most minimal change here that doesn't rock the boat.
> > I'm not out to rewrite the driver. I don't know the original author's
> > rationales. This patch here is correct and will generate the same code
> > as before on architectures where it wasn't broken.
> >
> > However, if you want your "change the codegen" patch to be taken
> > seriously, you should probably send it to the wireless maintainers like
> > this one, and they can decide. Personally, I don't really care either
> > way.
>
> I have checked the code paths there and I found no evidence that short can't be
> used. That's why my patch.
Do you have a rationale why you want to change codegen?
Jason
Powered by blists - more mailing lists