Skip to content

Commit fa3b4b9

Browse files
novitollgregkh
authored andcommitted
drivers/usb/mon: refactor min with min_t
Ensure type safety by using min_t() instead of casted min(). Signed-off-by: Sabyrzhan Tasbolatov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9a0c58d commit fa3b4b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/mon/mon_bin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static ssize_t mon_bin_read(struct file *file, char __user *buf,
823823
ep = MON_OFF2HDR(rp, rp->b_out);
824824

825825
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);
827827
ptr = ((char *)ep) + rp->b_read;
828828
if (step_len && copy_to_user(buf, ptr, step_len)) {
829829
mutex_unlock(&rp->fetch_lock);

0 commit comments

Comments
 (0)