diff for duplicates of <4F92C345.5060604@symas.com> diff --git a/a/1.txt b/N1/1.txt index 3f61abd..a6aaf30 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -13,7 +13,7 @@ Howard Chu wrote: >> >> tty: Add EXTPROC support for LINEMODE >> ->> == +>> ==== >> >> The code is now: >> @@ -23,15 +23,15 @@ Howard Chu wrote: >> spin_lock_irqsave(&tty->read_lock, flags); >> tty->read_tail = (tty->read_tail + n)& (N_TTY_BUF_SIZE-1); >> tty->read_cnt -= n; ->> if (L_EXTPROC(tty)&& tty->icanon&& n = 1) { ->> if (!tty->read_cnt&& (*b)[n-1] = EOF_CHAR(tty)) +>> if (L_EXTPROC(tty)&& tty->icanon&& n == 1) { +>> if (!tty->read_cnt&& (*b)[n-1] == EOF_CHAR(tty)) >> n--; >> } >> ->> == +>> ==== >> >> n after "n -= retval" means number of successfully copied chars. So the ->> test "n = 1" along with "!tty->read_cnt" actually should ensure we +>> test "n == 1" along with "!tty->read_cnt" actually should ensure we >> copied everything and that is exactly one char. Further we test if that >> one is EOF. If so, ignore that char by pretending we copied nothing. > @@ -51,7 +51,7 @@ Howard Chu wrote: > returned from the read. Been a while since I've thought about this. Perhaps it should simply have -checked if (tty->read_cnt = 1). +checked if (tty->read_cnt == 1). >> So to fix the user buffer dereference, the following diff should help. >> In any case the wrapped buffer is still to be fixed... (Or ignored.) @@ -71,15 +71,15 @@ checked if (tty->read_cnt = 1). >> retval = copy_to_user(*b, >> &tty->read_buf[tty->read_tail], n); >> n -= retval; ->> + is_eof = n = 1&& ->> + tty->read_buf[tty->read_tail] = EOF_CHAR(tty); +>> + is_eof = n == 1&& +>> + tty->read_buf[tty->read_tail] == EOF_CHAR(tty); >> tty_audit_add_data(tty,&tty->read_buf[tty->read_tail], n); >> spin_lock_irqsave(&tty->read_lock, flags); >> tty->read_tail = (tty->read_tail + n)& (N_TTY_BUF_SIZE-1); >> tty->read_cnt -= n; >> /* Turn single EOF into zero-length read */ ->> - if (L_EXTPROC(tty)&& tty->icanon&& n = 1) { ->> - if (!tty->read_cnt&& (*b)[n-1] = EOF_CHAR(tty)) +>> - if (L_EXTPROC(tty)&& tty->icanon&& n == 1) { +>> - if (!tty->read_cnt&& (*b)[n-1] == EOF_CHAR(tty)) >> - n--; >> - } >> + if (L_EXTPROC(tty)&& tty->icanon&& is_eof&& diff --git a/a/content_digest b/N1/content_digest index 0392be9..92386bb 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -4,7 +4,7 @@ "ref\04F92BE52.4020908@symas.com\0" "From\0Howard Chu <hyc@symas.com>\0" "Subject\0Re: [PATCH] drivers/tty: Use get_user instead of dereferencing user pointer\0" - "Date\0Sat, 21 Apr 2012 14:25:09 +0000\0" + "Date\0Sat, 21 Apr 2012 07:25:09 -0700\0" "To\0Jiri Slaby <jslaby@suse.cz>\0" "Cc\0Alan Cox <alan@lxorguk.ukuu.org.uk>" Emil Goode <emilgoode@gmail.com> @@ -29,7 +29,7 @@ ">>\n" ">> tty: Add EXTPROC support for LINEMODE\n" ">>\n" - ">> ==\n" + ">> ====\n" ">>\n" ">> The code is now:\n" ">>\n" @@ -39,15 +39,15 @@ ">> spin_lock_irqsave(&tty->read_lock, flags);\n" ">> tty->read_tail = (tty->read_tail + n)& (N_TTY_BUF_SIZE-1);\n" ">> tty->read_cnt -= n;\n" - ">> if (L_EXTPROC(tty)&& tty->icanon&& n = 1) {\n" - ">> if (!tty->read_cnt&& (*b)[n-1] = EOF_CHAR(tty))\n" + ">> if (L_EXTPROC(tty)&& tty->icanon&& n == 1) {\n" + ">> if (!tty->read_cnt&& (*b)[n-1] == EOF_CHAR(tty))\n" ">> n--;\n" ">> }\n" ">>\n" - ">> ==\n" + ">> ====\n" ">>\n" ">> n after \"n -= retval\" means number of successfully copied chars. So the\n" - ">> test \"n = 1\" along with \"!tty->read_cnt\" actually should ensure we\n" + ">> test \"n == 1\" along with \"!tty->read_cnt\" actually should ensure we\n" ">> copied everything and that is exactly one char. Further we test if that\n" ">> one is EOF. If so, ignore that char by pretending we copied nothing.\n" ">\n" @@ -67,7 +67,7 @@ "> returned from the read.\n" "\n" "Been a while since I've thought about this. Perhaps it should simply have \n" - "checked if (tty->read_cnt = 1).\n" + "checked if (tty->read_cnt == 1).\n" "\n" ">> So to fix the user buffer dereference, the following diff should help.\n" ">> In any case the wrapped buffer is still to be fixed... (Or ignored.)\n" @@ -87,15 +87,15 @@ ">> retval = copy_to_user(*b,\n" ">> &tty->read_buf[tty->read_tail], n);\n" ">> n -= retval;\n" - ">> + is_eof = n = 1&&\n" - ">> + tty->read_buf[tty->read_tail] = EOF_CHAR(tty);\n" + ">> + is_eof = n == 1&&\n" + ">> + tty->read_buf[tty->read_tail] == EOF_CHAR(tty);\n" ">> tty_audit_add_data(tty,&tty->read_buf[tty->read_tail], n);\n" ">> spin_lock_irqsave(&tty->read_lock, flags);\n" ">> tty->read_tail = (tty->read_tail + n)& (N_TTY_BUF_SIZE-1);\n" ">> tty->read_cnt -= n;\n" ">> /* Turn single EOF into zero-length read */\n" - ">> - if (L_EXTPROC(tty)&& tty->icanon&& n = 1) {\n" - ">> - if (!tty->read_cnt&& (*b)[n-1] = EOF_CHAR(tty))\n" + ">> - if (L_EXTPROC(tty)&& tty->icanon&& n == 1) {\n" + ">> - if (!tty->read_cnt&& (*b)[n-1] == EOF_CHAR(tty))\n" ">> - n--;\n" ">> - }\n" ">> + if (L_EXTPROC(tty)&& tty->icanon&& is_eof&&\n" @@ -116,4 +116,4 @@ " Director, Highland Sun http://highlandsun.com/hyc/\n" Chief Architect, OpenLDAP http://www.openldap.org/project/ -0e73cdc4dd0a1778a0a012a1812e3e9462d37a4a6d6733c02f50401bbc2d93f3 +1a4392e3534815bc50d0a377deef1a91d61bb2ebf3d4c2b5b985fbb04a67120a
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.