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

Configure Feed

Select the types of activity you want to include in your feed.

tty: switch count in tty_ldisc_receive_buf() to size_t

It comes from both paste_selection() and tty_port_default_receive_buf()
as unsigned (int and size_t respectively). Switch to size_t to converge
to that eventually.

Return the count as size_t too (the two callers above expect that).

Switch paste_selection()'s type of 'count' too, so that the returned and
passed type match.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-13-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
8d9526f9 201560af

+6 -6
+3 -3
drivers/tty/tty_buffer.c
··· 450 450 * 451 451 * Returns: the number of bytes processed. 452 452 */ 453 - int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 454 - const char *f, int count) 453 + size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 454 + const char *f, size_t count) 455 455 { 456 456 if (ld->ops->receive_buf2) 457 457 count = ld->ops->receive_buf2(ld->tty, p, f, count); 458 458 else { 459 - count = min_t(int, count, ld->tty->receive_room); 459 + count = min_t(size_t, count, ld->tty->receive_room); 460 460 if (count && ld->ops->receive_buf) 461 461 ld->ops->receive_buf(ld->tty, p, f, count); 462 462 }
+1 -1
drivers/tty/vt/selection.c
··· 376 376 { 377 377 struct vc_data *vc = tty->driver_data; 378 378 int pasted = 0; 379 - unsigned int count; 379 + size_t count; 380 380 struct tty_ldisc *ld; 381 381 DECLARE_WAITQUEUE(wait, current); 382 382 int ret = 0;
+2 -2
include/linux/tty_flip.h
··· 41 41 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); 42 42 } 43 43 44 - int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 45 - const char *f, int count); 44 + size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 45 + const char *f, size_t count); 46 46 47 47 void tty_buffer_lock_exclusive(struct tty_port *port); 48 48 void tty_buffer_unlock_exclusive(struct tty_port *port);