lkml.org 
[lkml]   [2022]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] wifi: rt2x00: use explicitly signed type for clamping
    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@linux-foundation.org>
    > > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    > > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
    > > Cc: Helmut Schaa <helmut.schaa@googlemail.com>
    > > Cc: Kalle Valo <kvalo@kernel.org>
    > > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    >
    > I prefer s8 just because is shorter name than short :-)

    Shouldn't the corresponding data structure type be fixed accordingly?

    --
    With Best Regards,
    Andy Shevchenko


    \
     
     \ /
      Last update: 2022-10-19 13:50    [W:4.296 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site