summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorSabyrzhan Tasbolatov <snovitoll@gmail.com>2024-11-12 20:58:14 +0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-13 15:09:51 +0100
commitfa3b4b9bc74c999457bce3a06d595e9aca814646 (patch)
tree4217a09e47a41ca479250cac66b6e89c55d4d61d /drivers/usb
parent9a0c58d025e8a01e726432006788a4b6f3179da2 (diff)
downloadlwn-fa3b4b9bc74c999457bce3a06d595e9aca814646.tar.gz
lwn-fa3b4b9bc74c999457bce3a06d595e9aca814646.zip
drivers/usb/mon: refactor min with min_t
Ensure type safety by using min_t() instead of casted min(). Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com> Link: https://lore.kernel.org/r/20241112155817.3512577-6-snovitoll@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/mon/mon_bin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index afb71c18415d..c93b43f5bc46 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -823,7 +823,7 @@ static ssize_t mon_bin_read(struct file *file, char __user *buf,
ep = MON_OFF2HDR(rp, rp->b_out);
if (rp->b_read < hdrbytes) {
- step_len = min(nbytes, (size_t)(hdrbytes - rp->b_read));
+ step_len = min_t(size_t, nbytes, hdrbytes - rp->b_read);
ptr = ((char *)ep) + rp->b_read;
if (step_len && copy_to_user(buf, ptr, step_len)) {
mutex_unlock(&rp->fetch_lock);