summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorSascha Silbe <silbe@linux.vnet.ibm.com>2016-09-20 13:09:07 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-09-30 03:13:21 -0400
commit6cd997db911f28f2510b771691270c52b63ed2e6 (patch)
treeffa2d2d89c8770097c0a840d8d314dfca2d67b7a /drivers/s390
parentc14f2aac7aa147861793eed9f41f91dd530f0be1 (diff)
s390/con3270: fix insufficient space padding
con3270 contains an optimisation that reduces the amount of data to be transmitted to the 3270 terminal by putting a Repeat to Address (RA) order into the data stream. The RA order itself takes up space, so con3270 only uses it if there's enough space left in the line buffer. Otherwise it just pads out the line manually. For lines that were _just_ short enough that the RA order still fit in the line buffer, the line was instead padded with an insufficient amount of spaces. This was caused by examining the size of the allocated line buffer rather than the length of the string to be displayed. For con3270_cline_end(), we just compare against the line length. For con3270_update_string() however that isn't available anymore, so we check whether the Repeat to Address order is present. Fixes: f51320a5 ("[PATCH] s390: new 3270 driver.") (tglx/history.git) Tested-by: Jing Liu <liujbjl@linux.vnet.ibm.com> Tested-by: Yang Chen <bjcyang@linux.vnet.ibm.com> Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/con3270.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index 0c161dbec73d..285b4006f44b 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -124,7 +124,12 @@ con3270_create_status(struct con3270 *cp)
124static void 124static void
125con3270_update_string(struct con3270 *cp, struct string *s, int nr) 125con3270_update_string(struct con3270 *cp, struct string *s, int nr)
126{ 126{
127 if (s->len >= cp->view.cols - 5) 127 if (s->len < 4) {
128 /* This indicates a bug, but printing a warning would
129 * cause a deadlock. */
130 return;
131 }
132 if (s->string[s->len - 4] != TO_RA)
128 return; 133 return;
129 raw3270_buffer_address(cp->view.dev, s->string + s->len - 3, 134 raw3270_buffer_address(cp->view.dev, s->string + s->len - 3,
130 cp->view.cols * (nr + 1)); 135 cp->view.cols * (nr + 1));
@@ -460,7 +465,7 @@ con3270_cline_end(struct con3270 *cp)
460 cp->cline->len + 4 : cp->view.cols; 465 cp->cline->len + 4 : cp->view.cols;
461 s = con3270_alloc_string(cp, size); 466 s = con3270_alloc_string(cp, size);
462 memcpy(s->string, cp->cline->string, cp->cline->len); 467 memcpy(s->string, cp->cline->string, cp->cline->len);
463 if (s->len < cp->view.cols - 5) { 468 if (cp->cline->len < cp->view.cols - 5) {
464 s->string[s->len - 4] = TO_RA; 469 s->string[s->len - 4] = TO_RA;
465 s->string[s->len - 1] = 0; 470 s->string[s->len - 1] = 0;
466 } else { 471 } else {