Commit cb1d1753 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron
Browse files

iio: core: Use min() instead of min_t() to make code more robust



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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230721170022.3461-5-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 90c62418
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;