Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp50648rwi; Tue, 18 Oct 2022 14:00:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kpfFTFS34c848xTdPmDWVTwig/LZ8dnslRK4Z6ks7fHtrSNizZRQQ3ZETauuKEk/KPjdV X-Received: by 2002:a05:6402:24a0:b0:454:d197:6238 with SMTP id q32-20020a05640224a000b00454d1976238mr4237429eda.274.1666126806953; Tue, 18 Oct 2022 14:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666126806; cv=none; d=google.com; s=arc-20160816; b=njJBd8ohx4nJNWNtMUw05R7tTwuS5qlY8zRWHdNNYZAJr4nFcX2Kyh3JF4JWzj+gdB i+2sWMlizpQBWDrobqPtZk1TLABUmA2m/tR+v0Z7BEdive3AiLGTAkv7lAYrbpELkKKT XquTkE27gUYAioUO5OVCjXxd8aTHIlXd4mTj3J0RBKW0BVkt8hrYwc99MaBtKABgK3BA 9r7p7tCFqzJS7daKDM6O0ZJNV/U31fJnaxlFd/gekIsTmOm1z6nOPnBcLoefYom91eGx I2VvcXHUXLx0n7q1ShZRJajMliZM4uMfukzSIDvq4g3UQjQVyO8WBAyS6xMaIPV7cVRi XTUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q2De+L2mj6ggKfV7A724gHHI+sEE+lO5v6yhYvbl6Qk=; b=n/RnE0ek1Ftev3/BA9ZEmpJYCQukloGwh9eN0d1sS4h3sH3yxpHu5yikRAB3FVL+wA 3xde1FsU9Cq5AwSJ6Tfml/nDy4T31O9E0fCTSZiEwFnqbCGnsxfZi+8ErxBJKCB32sUO gidZ9jQxX3/Z/EMjKey1DHyqXlDdat6jpTCeKOCqVpy3BoFVpoXr/7Lqdhut81kCARTA BEPj+1Dr0gYjSyfQHUcSeJdSvzd+xampJKPQ7UIBeIiI5JnqDbjGlQDETNYehNwufVzp ko/8tHlpNBkJ+gB6M4EuPidT2tx9K3Cwp6YOfTaNLkrJ74Onzw+lCVgiyhIyPmZUsc9B MZ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=CJR6Zcc+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga29-20020a1709070c1d00b0078d43ae07e1si13648621ejc.649.2022.10.18.13.59.38; Tue, 18 Oct 2022 14:00:06 -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=@zx2c4.com header.s=20210105 header.b=CJR6Zcc+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229756AbiJRUww (ORCPT + 63 others); Tue, 18 Oct 2022 16:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbiJRUwv (ORCPT ); Tue, 18 Oct 2022 16:52:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B7988275A; Tue, 18 Oct 2022 13:52:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B343CB8210F; Tue, 18 Oct 2022 20:52:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7904DC433D6; Tue, 18 Oct 2022 20:52:47 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="CJR6Zcc+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1666126366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q2De+L2mj6ggKfV7A724gHHI+sEE+lO5v6yhYvbl6Qk=; b=CJR6Zcc+einEF1tRKP8x+5xs1x8uCZkRdfQwqz9MP10kn5Ad97goZ5uf/TyWgw+N3/rd7o EOMhd+Lp2gK1sFTXexDzbM/4At2XND7eARz2Po4Ngh7eafhCCjJcPybt9Xh85y684gXfBU TlhQh8zd+xILLVAj10h2JDdyTpAvw0U= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id b088152b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 18 Oct 2022 20:52:45 +0000 (UTC) Date: Tue, 18 Oct 2022 14:52:43 -0600 From: "Jason A. Donenfeld" To: Andy Shevchenko 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=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 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. Jason