Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-merge
[firefly-linux-kernel-4.4.55.git] / drivers / tty / vt / selection.c
index 67b1d0d7c8acb924fdc481cfc75b36fa6c925de8..fb864e7fcd13f684e30108a02189f6b99c9315fc 100644 (file)
@@ -332,7 +332,8 @@ int paste_selection(struct tty_struct *tty)
                        continue;
                }
                count = sel_buffer_lth - pasted;
-               count = tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
+               count = min(count, tty->receive_room);
+               tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
                                                                NULL, count);
                pasted += count;
        }