mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
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>
This commit is contained in:
parent
9a0c58d025
commit
fa3b4b9bc7
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user