[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221020104040.GB95289@wp.pl>
Date: Thu, 20 Oct 2022 12:40:40 +0200
From: Stanislaw Gruszka <stf_xl@...pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Helmut Schaa <helmut.schaa@...glemail.com>,
Kalle Valo <kvalo@...nel.org>
Subject: Re: [PATCH] wifi: rt2x00: use explicitly signed type for clamping
On Wed, Oct 19, 2022 at 02:04:57PM +0300, Andy Shevchenko wrote:
> On Wed, Oct 19, 2022 at 10:52:19AM +0200, Stanislaw Gruszka 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.
> > >
> > > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > > Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > > Cc: Stanislaw Gruszka <stf_xl@...pl>
> > > Cc: Helmut Schaa <helmut.schaa@...glemail.com>
> > > Cc: Kalle Valo <kvalo@...nel.org>
> > > Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
> >
> > I prefer s8 just because is shorter name than short :-)
>
> Shouldn't the corresponding data structure type be fixed accordingly?
We can change types of channel_info default_power* fields in rt2x00.h,
but I'm a bit reluctant to do so, as I'm afraid this could change
actual power values sent to the hardware and will require careful
verification.
Regards
Stanislaw
Powered by blists - more mailing lists