Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sabyrzhan Tasbolatov and committed by
Greg Kroah-Hartman
fa3b4b9b 9a0c58d0

+1 -1
+1 -1
drivers/usb/mon/mon_bin.c
··· 823 823 ep = MON_OFF2HDR(rp, rp->b_out); 824 824 825 825 if (rp->b_read < hdrbytes) { 826 - step_len = min(nbytes, (size_t)(hdrbytes - rp->b_read)); 826 + step_len = min_t(size_t, nbytes, hdrbytes - rp->b_read); 827 827 ptr = ((char *)ep) + rp->b_read; 828 828 if (step_len && copy_to_user(buf, ptr, step_len)) { 829 829 mutex_unlock(&rp->fetch_lock);