Skip to content

Commit 5b06210

Browse files
committed
drivers/can/can.c: fix broken O_NONBLOCK
O_NONBLOCK open mode was broken since #17360 MIN() comapres signed value (int) with unsigned value (size_t) which causes an unexpected return value when ret is negative Signed-off-by: raiden00pl <[email protected]>
1 parent e87082b commit 5b06210

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/can/can.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ static ssize_t can_read(FAR struct file *filep, FAR char *buffer,
518518

519519
/* ret can be more than buflen due to roundup, so return at most buflen */
520520

521-
return ret ? MIN(ret, buflen) : -EMSGSIZE;
521+
return ret ? MIN(ret, (int)buflen) : -EMSGSIZE;
522522
}
523523

524524
/****************************************************************************

0 commit comments

Comments
 (0)