From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32C9930FA4 for ; Wed, 20 Sep 2023 12:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE2AFC433C8; Wed, 20 Sep 2023 12:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695212394; bh=gym1pCkwET6gNGPg9FoIosdlK6tFLCQG7B9b8rgkCSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohw+jseQBJnxgfm1NeGs/FjqGkxxdzkt+rvPOIWGY6nybxsAKC5fDUJyJ38fQ+qEl dIvnHDhJ3svxnVOMCjvOB5d1gTk/OMhher8Z31II16JLkMqj2zvkIkcsZqQ7KUY/DC F4oTnLyRP9bNborPFaIVzXGRoTgPglwOWBD8KM0U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andy Shevchenko , Nuno Sa , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 259/273] iio: core: Use min() instead of min_t() to make code more robust Date: Wed, 20 Sep 2023 13:31:39 +0200 Message-ID: <20230920112854.269387388@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112846.440597133@linuxfoundation.org> References: <20230920112846.440597133@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Shevchenko [ Upstream commit cb1d17535061ca295903f97f5cb0af9db719c02c ] 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 Link: https://lore.kernel.org/r/20230721170022.3461-5-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- 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 49d4b4f1a4574..ad9bd2001fbd2 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -323,7 +323,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.1