Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp50688rwi; Tue, 18 Oct 2022 14:00:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7L0UxunaBihkYhuds7Z05CbOyk6NiJQPub0+/OKMkWcbPWcgtsXaiDkby6u1jWH985bhoE X-Received: by 2002:a17:907:9485:b0:78e:119f:940 with SMTP id dm5-20020a170907948500b0078e119f0940mr3750921ejc.535.1666126808637; Tue, 18 Oct 2022 14:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666126808; cv=none; d=google.com; s=arc-20160816; b=dsXUUBME/f3mwPLZttSpBteyw3ndEzFfYuC9j75VUToWXFJ9mWxK2zHHsRdhjOkeGp V+CJKY8+PfmkXVasrrCJhsYFmKQbxEbDSCxE50JtkYHG/fVXf0SY8jjlzWXIhyRiryQa qybvnnuk5n8CqvUStwY/Zci8kmBGelx1V1fXHQv9jghSu4/QGsVOxJrFkXI8L7ovva16 +gJl9ogz70UWA167kh7//MlvvH9LeVQtWyyikGTR3f3uHg2Orz2EkgM0mmeBFIw3KLnn kcfmLsib0tKv0nj2lNJULHwMWSVyUZ/QHdyNtCDH1Gn8CyzaeeJVxH78dHBrORfiWTP2 pM3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xX1ktvpniQvMuPCvICly9vBoXniWJuN6Wadi/GXc2Yk=; b=XutqVpmrBGoMdHgoQYTKQn6Q+sX+AIdnRkIzFRFCFSr7aQO/TGwgHWKcPEriFcWBqK em4W442CaGu/qbkgv/6KymIQsm9btLzhAMt+wvdrxfCA5EWlve9RMXXWG/U5+31GHVSn qxCmG5VG/JkFunKQfSYTQkMth4HY/p1scJJRTfyuWWwvc7fJ3V0t4kkrtL2VAODyNjhB O43uawlAK/+VF2ubcLVVL41tPlu4CC5ZQ+wbWZod3ObWRrQikndbOWYR6ZCkOAYTrMzi 4JbLgNRbt5G0/1OQ9HkTqqW748G0OsBUcyR4YL5DF/QzL6RKB/GEOGVkbI8Ex3WMKB87 TsIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NQ4EQ9z2; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a05640242d100b00456662097dasi15655743edc.69.2022.10.18.13.59.51; Tue, 18 Oct 2022 14:00:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NQ4EQ9z2; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbiJRU5r (ORCPT + 63 others); Tue, 18 Oct 2022 16:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiJRU5o (ORCPT ); Tue, 18 Oct 2022 16:57:44 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1845653A54; Tue, 18 Oct 2022 13:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666126664; x=1697662664; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Iw7ifpwqC5dIzOmjFQLDFvPXcRHwlPq0OQd/Sm9QAtA=; b=NQ4EQ9z2BxtfVz9nxbG04h38WFmQLNE3XmBGXW3yvSqwfDxm1bM9qq8e GISOio/mOU1b1xAslEGQjyx85NbXPU+DaUwT4p3q3pq+hX1DwAgpZ/Q7h h5CifCbwYiBD4H3V+KjPePyTvPuy3yvOAcNQCwzotU5r/qjfMhNSV/vnY 58mI9GCbdmPN3krqUBMzcyus5xYywovZZW50mPtD9zHcBgHH5QMOpaHoF AR5+Fys26yZujCi/bR1+dvEhpYWYtZ0dUXM7jkHK37R8flSbRb2wxT9rU 69hux/erEHRxUdHymsSoHYmz3nTCwyE/msR9P5TCSxvj9HXgs7BVSadfh w==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="289553784" X-IronPort-AV: E=Sophos;i="5.95,194,1661842800"; d="scan'208";a="289553784" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 13:57:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="803946119" X-IronPort-AV: E=Sophos;i="5.95,194,1661842800"; d="scan'208";a="803946119" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga005.jf.intel.com with ESMTP; 18 Oct 2022 13:57:41 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1okted-009YNz-1S; Tue, 18 Oct 2022 23:57:39 +0300 Date: Tue, 18 Oct 2022 23:57:39 +0300 From: Andy Shevchenko To: "Jason A. Donenfeld" Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , Stanislaw Gruszka , Helmut Schaa , Kalle Valo Subject: Re: [PATCH] wifi: rt2x00: use explicitly signed type for clamping Message-ID: References: <202210190108.ESC3pc3D-lkp@intel.com> <20221018202734.140489-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. Okay, I will formally send it to the corresponding maintainers. But if they want, they can always download this thread using `b4` tool and at least comment on it. -- With Best Regards, Andy Shevchenko