Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp202205rwo; Fri, 21 Jul 2023 10:29:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEkuQwl9bF+D3zYiKS4bYn4Nr43EfuPSZRgEOvb4PEVqW6It1JgTgAqqWuwgoup5uo+LEtT X-Received: by 2002:a17:90a:8414:b0:25b:d292:d9a3 with SMTP id j20-20020a17090a841400b0025bd292d9a3mr2437471pjn.37.1689960552014; Fri, 21 Jul 2023 10:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689960551; cv=none; d=google.com; s=arc-20160816; b=qWws5+13ipMUMOfZl1DKa8kP3flxTiN4IMxvB7/DyjAap7aNOToqrpCeZZuhsVq5/l T7N9HZg7IfJh/CXVpXC+9XwA5VYBTyXfK6W2op5rN0ktCs2iZi75unomeZbsvze+ZdcM FKZP6ehpEi+QNSjGXWGGc56DYr4LppzsjGOzxiJQed5WaLJ7jfCmWU/ikmuyWCJxAwz7 uFbnKDdtyXOpIyLTM+lJgfNXSA0Td/CjwdS+HbrAlYL8tCmz8vfG2M1PcR+p2fpWZz5F TDxXtTjO/86vTEd1pKxvW2IgDKEaxXAHVtPTV6nnjO69duCkeM0NmX1rkr8dxCkhwacw x4vw== 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:date:subject:cc:to:from :dkim-signature; bh=Ns28UV9+6BxfPhEaJOZvh4/qN0snNowpbOsznuSEPgs=; fh=zI/sCjjpFZFpRWFbJrpu9GJ6xSZKd2JacIs4UkYeF5Q=; b=vVdrzzP9gdZoY0cWpvmJHG5TEWW4sSu6a292937KhGCpE+MVsIF85nZpNcEjMKHWPs uMn3IUhncIwevaLCYYTpyNciz7BzcMiU2S7GXw0C+1+I8UsQbVpDwW/quXQo2lpNW5U0 RTRxmRvq7fvvCnxBCckr22dkcRmdXGsF33XA0tidmEnTSDBWidZRuBAAdDwCELyTZSsC 6pWwkoYoQ7WXQfJYQECVqLkyp62q8+qfuVvQ5dAHAwi4o+H0ofJxXlK5E076OevNSYeR gTBYO6kg9aR4lY+/mwp/vOqM8egXsov0q9sz9wpCPb9Pb7LaJwe15bDDac+ub4vTMIRs fSYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R3GGX5vn; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w185-20020a6382c2000000b0053f29758cd1si3289938pgd.839.2023.07.21.10.28.59; Fri, 21 Jul 2023 10:29:11 -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=@intel.com header.s=Intel header.b=R3GGX5vn; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjGURAZ (ORCPT + 99 others); Fri, 21 Jul 2023 13:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbjGURAU (ORCPT ); Fri, 21 Jul 2023 13:00:20 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2CBE26A0; Fri, 21 Jul 2023 10:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689958818; x=1721494818; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UZLQH0kViux9VJJxBn8faoSNy7gR7pEqp4KmqCGfoYU=; b=R3GGX5vnHWgT7f+TO9myhR7lxYMIEzh33BtzFngVA9TMR/wB9Wud2Aka XixqJ6qfkfWUxsk46BSau0sNO+uvwnqrHkJ92g9PAJmXQX9F+3a6pIFgc oDc/QOiW+XZIN1lR5tviy+VJwabvwsvDFyzxqMrPJUnJi9uMg8UE/k2fd W0tagzMUzIE9zZrAohKsDlyUQPE5sEcm39cCGK/u+1P7vDnQIML1yvoU6 HreOArqOUCV6CfalsLbIOUvd5n+rXAFLgJkrpNt1PpZ89toKi+mL61bAt 35k/ybFoX8b64EDv7kYcsBXp/SjawXVlucacDRHWbWHhEuD06VH+qPC3b w==; X-IronPort-AV: E=McAfee;i="6600,9927,10778"; a="369739466" X-IronPort-AV: E=Sophos;i="6.01,222,1684825200"; d="scan'208";a="369739466" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2023 10:00:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10778"; a="754540196" X-IronPort-AV: E=Sophos;i="6.01,222,1684825200"; d="scan'208";a="754540196" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 21 Jul 2023 10:00:15 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 609895FC; Fri, 21 Jul 2023 20:00:23 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Nuno Sa Subject: [PATCH v2 4/8] iio: core: Use min() instead of min_t() to make code more robust Date: Fri, 21 Jul 2023 20:00:18 +0300 Message-Id: <20230721170022.3461-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230721170022.3461-1-andriy.shevchenko@linux.intel.com> References: <20230721170022.3461-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 --- 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; -- 2.40.0.1.gaa8946217a0b