From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2031C32771 for ; Mon, 26 Sep 2022 18:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiIZSbC (ORCPT ); Mon, 26 Sep 2022 14:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiIZSbB (ORCPT ); Mon, 26 Sep 2022 14:31:01 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADEEB3DF3E for ; Mon, 26 Sep 2022 11:31:00 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id f23so7017063plr.6 for ; Mon, 26 Sep 2022 11:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=JDnfp+dxjaa9G7LgXlHC4/m28SGyrqj6Pcl9IikPnXI=; b=lxZ9MhPOSGxCpI+kdXOqnI0wWGqI86mHU5307O4GzXhoWGBT7OGuY1deL991Uvsuyi aSE4dW59QnQi8/M/ORuzoqRGqW+clqC8lLTumjxBO5/NzMzX1F5N15vkBpOfggfaj9Tt eiTK0M+QmH2HdGmLn0KmCtyb8DjrOqtN5nZ1E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=JDnfp+dxjaa9G7LgXlHC4/m28SGyrqj6Pcl9IikPnXI=; b=woUc9d5saxwQ3GfT16ZXMmIXSYdQWLU8DOrw9vB8zpJxYtDtIIp11pvtZ2PPIc4r6M kJhL0gQIMBEn2x5mw9VAC0AYDf3anC+isAfMhhUNKd2R4EQJeFcsuHr7YdJLWbvIYl9T 9RMkthpsqzXLzzYDWSp4Jx5sz/dsZds9Dq5v/EEn5aCIOHziAftiEG4S2mPIS2dqcaZB dLcAv3BxZKLHfIhi94iN//0g/3nHw+exZT4H/6N6TqnZYCXxYCwjWl71xL7woAElCzQE SyyzXmy3fyd5olwvAtqxkg29V1N9F7EYiGEfp3162r2BSTJV4eKWe+4Q3P0LkFmdmbkO B0+w== X-Gm-Message-State: ACrzQf2BJ6X3THlg1be2tPZUYlJc3/JS2dVt3k3GTtwYxwU1fBW0ok+2 7AdeLqtevjy2W6dU4ORA8gWbcA== X-Google-Smtp-Source: AMsMyM4ZHrL/CxfzRTi4el16mgnFMEbJVuAla2+VNWr5QuRipraqPoBca8HrDrpaTwgPiGBZUHflww== X-Received: by 2002:a17:902:c213:b0:176:cdb9:c504 with SMTP id 19-20020a170902c21300b00176cdb9c504mr23067649pll.44.1664217060224; Mon, 26 Sep 2022 11:31:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i10-20020a056a00004a00b00540a346477csm12599184pfk.76.2022.09.26.11.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 11:30:59 -0700 (PDT) Date: Mon, 26 Sep 2022 11:30:58 -0700 From: Kees Cook To: "Jason A. Donenfeld" Cc: Andy Shevchenko , Andrew Morton , linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org Subject: Re: [PATCH v2] minmax: clamp more efficiently by avoiding extra comparison Message-ID: <202209261130.2C96929E38@keescook> References: <20220923154001.4074849-1-Jason@zx2c4.com> <20220923155412.b0132fc62eca18817a023cd2@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Mon, Sep 26, 2022 at 02:23:48PM +0200, Jason A. Donenfeld wrote: > On Mon, Sep 26, 2022 at 12:00 PM Andy Shevchenko > wrote: > > > > On Sat, Sep 24, 2022 at 12:37:26PM +0200, Jason A. Donenfeld wrote: > > > On Fri, Sep 23, 2022 at 03:54:12PM -0700, Andrew Morton wrote: > > > > On Fri, 23 Sep 2022 17:40:01 +0200 "Jason A. Donenfeld" wrote: > > > > ... > > > > > Worth noting, by the way, is that the input validation check already > > > caught a bug when 0day test bot choked: > > > > > > https://lore.kernel.org/linux-hwmon/20220924101151.4168414-1-Jason@zx2c4.com/ > > > > Hooray, it was a good idea! :-) > > > > > So, options: > > > 1) Keep this patch as-is, because it is useful on modern compilers. > > > 2) Add an ifdef on compiler version, so we generate the best code in > > > each case. > > > 3) Go back to testing twice, but keep the checker macro because it's > > > apparently useful. > > > 4) Do nothing and discard this series. > > > > > > Any of those are okay with me. Opinions? > > > > I tend to case 3) (I believe you typo'ed double 2) cases) and apply the rest > > as a separate change with all downsides explained (kinda 1) approach). > > Alright, I'll do that. v3 on its way, then. Cool. I've dropped v2 from my -next tree. -- Kees Cook