Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1875096rwo; Sun, 23 Jul 2023 02:39:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlFxcUCl2vaKqbsgKJMfnLdbB9WEv0p9dKdHBeOWoGapmKNTRWzUHA+edbemR0yV45IRTTJb X-Received: by 2002:a17:907:78d5:b0:98d:e605:2bce with SMTP id kv21-20020a17090778d500b0098de6052bcemr6333928ejc.46.1690105147550; Sun, 23 Jul 2023 02:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690105147; cv=none; d=google.com; s=arc-20160816; b=1EzhsdMNC70TVJFni1i4yL88np6LSx4qMpPECcUN16tdx2GOIOPjo7qoN8zF1cwpo5 D3vXovCKv+SeowpNaI4Nfr82eHl0S42szRrjdLbhReqIvGwhazDtcevZcAI7esBBicjT kbs1JX0PT+2UbBrSU31BDPTy4z0gnuh/N4nAHk5qCfJw+gHL7QDRe1KFUSpjqVpIECg+ O9qmBKpY9QXI6a3g6hpp5n7pAcPyoLK03tYbXEyKbn+jvJe7hh+PpHf9320+58Z8MQoJ ZG145nWjR33JdRpPjGKQ1PtFxuHUtMihIIDqDAZSUQ8VP4UWS186DcQiMdFIul7mvb08 SDrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=A9BhaVKdD79vVdkVgEq5Ii8dRQ1az8ql///lxYyuXSg=; fh=hXZqJJZJy2kBvSIwtK1y24jCZlpvbojtkV5YMKVmUAQ=; b=qvw/pvBNahWkUCzN0V6Doa0IL6dTQ+fmDd8x9oAuBzJ8kPq5hGuAveWqgkCjlt6mS/ fuwTBsuNQV8vr9rLed/4Rsq+zEu3G0jPRo/pYCvenrePNb57xzKIsZHGoS22BFZJz2v1 bO4PiVu6lhX9unwPkxtMsDzJFbhCIi6OjtFJytPNUlVrOERTkhrNtJxZG1hq9km8iQXi wZnEaKLa4Doy79CVze0eR9wJPVMWkKKXp/zv0m0urpMKduWcgAYBXQ5b/1xZA2QUzESS GTopGt9mxMbUf+grva2U0jW+H/UeHzgwEMRdAQRLCNjuyxX5V4sa0EF9v+t/A+/gbU8f 9/Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="u/vBOnMY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me25-20020a170906aed900b00993fe9ca8cfsi4511321ejb.766.2023.07.23.02.38.43; Sun, 23 Jul 2023 02:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b="u/vBOnMY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229582AbjGWJOW (ORCPT + 99 others); Sun, 23 Jul 2023 05:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjGWJOV (ORCPT ); Sun, 23 Jul 2023 05:14:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 888A511A; Sun, 23 Jul 2023 02:14:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C32760C6E; Sun, 23 Jul 2023 09:14:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFC31C433C8; Sun, 23 Jul 2023 09:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690103659; bh=+HiYmb3h6MjhbT0M83KKrszck2MUxAywWJQFxYWzduY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=u/vBOnMYY9aGHrBSD4Y2xHMZyluT+RndYR5GuYg353tsVQ/PZF08s4Ds2c1QppbUL xmzk+zi5xtAi9YNEawzqGEqvy8CRxlhwRuRieSoU4T7xsDgyEg8STaZoPhxm1qjktO azMZQoHgtLLJlSlBy0P+3jvSJx+LHC/LxS0GNHWMq+fxnDFjMX/T0QylG4FMkIvkL3 d2yhSIXDEb/UZbvvzEPeSrWqFicf5EHMExjFgOvCmiiOXMEN17pQNxomOmR94HzhVb 32OlwySTBZfFxHmbgyzvFxlo2KnyHqMe//1WwuY60d1U/pUlXzJx89yvvJWGPS6SqJ UjqZFvHL3lZHw== Date: Sun, 23 Jul 2023 10:14:16 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Nuno Sa Subject: Re: [PATCH v2 4/8] iio: core: Use min() instead of min_t() to make code more robust Message-ID: <20230723101416.398589b3@jic23-huawei> In-Reply-To: <20230721170022.3461-5-andriy.shevchenko@linux.intel.com> References: <20230721170022.3461-1-andriy.shevchenko@linux.intel.com> <20230721170022.3461-5-andriy.shevchenko@linux.intel.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On Fri, 21 Jul 2023 20:00:18 +0300 Andy Shevchenko wrote: > min() has strict type checking and preferred over min_t() for > unsigned types to avoid overflow. Here it's unclear why min_t() > was chosen since both variables are of the same type. In any > case update to use min(). > > Signed-off-by: Andy Shevchenko > Reviewed-by: Nuno Sa Applied to the togreg branch of iio.git and pushed out as testing for 0-day to give it a quick sanity check. Thanks, Jonathan > --- > drivers/iio/industrialio-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > index 6e28c2a3d223..78cc67efa490 100644 > --- a/drivers/iio/industrialio-core.c > +++ b/drivers/iio/industrialio-core.c > @@ -389,7 +389,7 @@ static ssize_t iio_debugfs_write_reg(struct file *file, > char buf[80]; > int ret; > > - count = min_t(size_t, count, (sizeof(buf)-1)); > + count = min(count, sizeof(buf) - 1); > if (copy_from_user(buf, userbuf, count)) > return -EFAULT; >