aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-31 20:00:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-31 20:00:27 -0500
commit8c4e378e426d1b065a1e8d9f45b8bcc4905d3410 (patch)
tree1d677fb5d7cc7f39f3705ea9969c14e196aba965
parentf3ca903fbbb0d26221a39cbebfe6dd4efbebd3ef (diff)
parent88867e3d0b7eea256c1cd432b0a3c7a21e8edf07 (diff)
Merge tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging fixes from Greg KH: "Here are some small staging driver fixes for 4.5-rc2. One of them predated 4.4-final, but I missed that merge window due to the holliday. The others fix reported issues that have come up recently. The tty change is needed for the speakup driver fix and has the ack of the tty driver maintainer as well, i.e. myself :) All have been in linux-next with no reported issues" * tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: Staging: speakup: fix read scrolled-back VT Staging: speakup: Fix getting port information Revert "Staging: panel: usleep_range is preferred over udelay" iio: adis_buffer: Fix out-of-bounds memory access
-rw-r--r--drivers/iio/imu/adis_buffer.c2
-rw-r--r--drivers/staging/panel/panel.c34
-rw-r--r--drivers/staging/speakup/main.c21
-rw-r--r--drivers/staging/speakup/serialio.c13
-rw-r--r--drivers/tty/vt/vt.c1
5 files changed, 42 insertions, 29 deletions
diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
index cb32b593f1c5..36607d52fee0 100644
--- a/drivers/iio/imu/adis_buffer.c
+++ b/drivers/iio/imu/adis_buffer.c
@@ -43,7 +43,7 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
43 return -ENOMEM; 43 return -ENOMEM;
44 44
45 rx = adis->buffer; 45 rx = adis->buffer;
46 tx = rx + indio_dev->scan_bytes; 46 tx = rx + scan_count;
47 47
48 spi_message_init(&adis->msg); 48 spi_message_init(&adis->msg);
49 49
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 79ac19246548..70b8f4fabfad 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -825,8 +825,7 @@ static void lcd_write_cmd_s(int cmd)
825 lcd_send_serial(0x1F); /* R/W=W, RS=0 */ 825 lcd_send_serial(0x1F); /* R/W=W, RS=0 */
826 lcd_send_serial(cmd & 0x0F); 826 lcd_send_serial(cmd & 0x0F);
827 lcd_send_serial((cmd >> 4) & 0x0F); 827 lcd_send_serial((cmd >> 4) & 0x0F);
828 /* the shortest command takes at least 40 us */ 828 udelay(40); /* the shortest command takes at least 40 us */
829 usleep_range(40, 100);
830 spin_unlock_irq(&pprt_lock); 829 spin_unlock_irq(&pprt_lock);
831} 830}
832 831
@@ -837,8 +836,7 @@ static void lcd_write_data_s(int data)
837 lcd_send_serial(0x5F); /* R/W=W, RS=1 */ 836 lcd_send_serial(0x5F); /* R/W=W, RS=1 */
838 lcd_send_serial(data & 0x0F); 837 lcd_send_serial(data & 0x0F);
839 lcd_send_serial((data >> 4) & 0x0F); 838 lcd_send_serial((data >> 4) & 0x0F);
840 /* the shortest data takes at least 40 us */ 839 udelay(40); /* the shortest data takes at least 40 us */
841 usleep_range(40, 100);
842 spin_unlock_irq(&pprt_lock); 840 spin_unlock_irq(&pprt_lock);
843} 841}
844 842
@@ -848,20 +846,19 @@ static void lcd_write_cmd_p8(int cmd)
848 spin_lock_irq(&pprt_lock); 846 spin_lock_irq(&pprt_lock);
849 /* present the data to the data port */ 847 /* present the data to the data port */
850 w_dtr(pprt, cmd); 848 w_dtr(pprt, cmd);
851 /* maintain the data during 20 us before the strobe */ 849 udelay(20); /* maintain the data during 20 us before the strobe */
852 usleep_range(20, 100);
853 850
854 bits.e = BIT_SET; 851 bits.e = BIT_SET;
855 bits.rs = BIT_CLR; 852 bits.rs = BIT_CLR;
856 bits.rw = BIT_CLR; 853 bits.rw = BIT_CLR;
857 set_ctrl_bits(); 854 set_ctrl_bits();
858 855
859 usleep_range(40, 100); /* maintain the strobe during 40 us */ 856 udelay(40); /* maintain the strobe during 40 us */
860 857
861 bits.e = BIT_CLR; 858 bits.e = BIT_CLR;
862 set_ctrl_bits(); 859 set_ctrl_bits();
863 860
864 usleep_range(120, 500); /* the shortest command takes at least 120 us */ 861 udelay(120); /* the shortest command takes at least 120 us */
865 spin_unlock_irq(&pprt_lock); 862 spin_unlock_irq(&pprt_lock);
866} 863}
867 864
@@ -871,20 +868,19 @@ static void lcd_write_data_p8(int data)
871 spin_lock_irq(&pprt_lock); 868 spin_lock_irq(&pprt_lock);
872 /* present the data to the data port */ 869 /* present the data to the data port */
873 w_dtr(pprt, data); 870 w_dtr(pprt, data);
874 /* maintain the data during 20 us before the strobe */ 871 udelay(20); /* maintain the data during 20 us before the strobe */
875 usleep_range(20, 100);
876 872
877 bits.e = BIT_SET; 873 bits.e = BIT_SET;
878 bits.rs = BIT_SET; 874 bits.rs = BIT_SET;
879 bits.rw = BIT_CLR; 875 bits.rw = BIT_CLR;
880 set_ctrl_bits(); 876 set_ctrl_bits();
881 877
882 usleep_range(40, 100); /* maintain the strobe during 40 us */ 878 udelay(40); /* maintain the strobe during 40 us */
883 879
884 bits.e = BIT_CLR; 880 bits.e = BIT_CLR;
885 set_ctrl_bits(); 881 set_ctrl_bits();
886 882
887 usleep_range(45, 100); /* the shortest data takes at least 45 us */ 883 udelay(45); /* the shortest data takes at least 45 us */
888 spin_unlock_irq(&pprt_lock); 884 spin_unlock_irq(&pprt_lock);
889} 885}
890 886
@@ -894,7 +890,7 @@ static void lcd_write_cmd_tilcd(int cmd)
894 spin_lock_irq(&pprt_lock); 890 spin_lock_irq(&pprt_lock);
895 /* present the data to the control port */ 891 /* present the data to the control port */
896 w_ctr(pprt, cmd); 892 w_ctr(pprt, cmd);
897 usleep_range(60, 120); 893 udelay(60);
898 spin_unlock_irq(&pprt_lock); 894 spin_unlock_irq(&pprt_lock);
899} 895}
900 896
@@ -904,7 +900,7 @@ static void lcd_write_data_tilcd(int data)
904 spin_lock_irq(&pprt_lock); 900 spin_lock_irq(&pprt_lock);
905 /* present the data to the data port */ 901 /* present the data to the data port */
906 w_dtr(pprt, data); 902 w_dtr(pprt, data);
907 usleep_range(60, 120); 903 udelay(60);
908 spin_unlock_irq(&pprt_lock); 904 spin_unlock_irq(&pprt_lock);
909} 905}
910 906
@@ -947,7 +943,7 @@ static void lcd_clear_fast_s(void)
947 lcd_send_serial(0x5F); /* R/W=W, RS=1 */ 943 lcd_send_serial(0x5F); /* R/W=W, RS=1 */
948 lcd_send_serial(' ' & 0x0F); 944 lcd_send_serial(' ' & 0x0F);
949 lcd_send_serial((' ' >> 4) & 0x0F); 945 lcd_send_serial((' ' >> 4) & 0x0F);
950 usleep_range(40, 100); /* the shortest data takes at least 40 us */ 946 udelay(40); /* the shortest data takes at least 40 us */
951 } 947 }
952 spin_unlock_irq(&pprt_lock); 948 spin_unlock_irq(&pprt_lock);
953 949
@@ -971,7 +967,7 @@ static void lcd_clear_fast_p8(void)
971 w_dtr(pprt, ' '); 967 w_dtr(pprt, ' ');
972 968
973 /* maintain the data during 20 us before the strobe */ 969 /* maintain the data during 20 us before the strobe */
974 usleep_range(20, 100); 970 udelay(20);
975 971
976 bits.e = BIT_SET; 972 bits.e = BIT_SET;
977 bits.rs = BIT_SET; 973 bits.rs = BIT_SET;
@@ -979,13 +975,13 @@ static void lcd_clear_fast_p8(void)
979 set_ctrl_bits(); 975 set_ctrl_bits();
980 976
981 /* maintain the strobe during 40 us */ 977 /* maintain the strobe during 40 us */
982 usleep_range(40, 100); 978 udelay(40);
983 979
984 bits.e = BIT_CLR; 980 bits.e = BIT_CLR;
985 set_ctrl_bits(); 981 set_ctrl_bits();
986 982
987 /* the shortest data takes at least 45 us */ 983 /* the shortest data takes at least 45 us */
988 usleep_range(45, 100); 984 udelay(45);
989 } 985 }
990 spin_unlock_irq(&pprt_lock); 986 spin_unlock_irq(&pprt_lock);
991 987
@@ -1007,7 +1003,7 @@ static void lcd_clear_fast_tilcd(void)
1007 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) { 1003 for (pos = 0; pos < lcd.height * lcd.hwidth; pos++) {
1008 /* present the data to the data port */ 1004 /* present the data to the data port */
1009 w_dtr(pprt, ' '); 1005 w_dtr(pprt, ' ');
1010 usleep_range(60, 120); 1006 udelay(60);
1011 } 1007 }
1012 1008
1013 spin_unlock_irq(&pprt_lock); 1009 spin_unlock_irq(&pprt_lock);
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 63c59bc89b04..30cf973f326d 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -264,8 +264,9 @@ static struct notifier_block vt_notifier_block = {
264 .notifier_call = vt_notifier_call, 264 .notifier_call = vt_notifier_call,
265}; 265};
266 266
267static unsigned char get_attributes(u16 *pos) 267static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
268{ 268{
269 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
269 return (u_char) (scr_readw(pos) >> 8); 270 return (u_char) (scr_readw(pos) >> 8);
270} 271}
271 272
@@ -275,7 +276,7 @@ static void speakup_date(struct vc_data *vc)
275 spk_y = spk_cy = vc->vc_y; 276 spk_y = spk_cy = vc->vc_y;
276 spk_pos = spk_cp = vc->vc_pos; 277 spk_pos = spk_cp = vc->vc_pos;
277 spk_old_attr = spk_attr; 278 spk_old_attr = spk_attr;
278 spk_attr = get_attributes((u_short *) spk_pos); 279 spk_attr = get_attributes(vc, (u_short *)spk_pos);
279} 280}
280 281
281static void bleep(u_short val) 282static void bleep(u_short val)
@@ -469,8 +470,12 @@ static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
469 u16 ch = ' '; 470 u16 ch = ' ';
470 471
471 if (vc && pos) { 472 if (vc && pos) {
472 u16 w = scr_readw(pos); 473 u16 w;
473 u16 c = w & 0xff; 474 u16 c;
475
476 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, 1);
477 w = scr_readw(pos);
478 c = w & 0xff;
474 479
475 if (w & vc->vc_hi_font_mask) 480 if (w & vc->vc_hi_font_mask)
476 c |= 0x100; 481 c |= 0x100;
@@ -746,7 +751,7 @@ static int get_line(struct vc_data *vc)
746 u_char tmp2; 751 u_char tmp2;
747 752
748 spk_old_attr = spk_attr; 753 spk_old_attr = spk_attr;
749 spk_attr = get_attributes((u_short *) spk_pos); 754 spk_attr = get_attributes(vc, (u_short *)spk_pos);
750 for (i = 0; i < vc->vc_cols; i++) { 755 for (i = 0; i < vc->vc_cols; i++) {
751 buf[i] = (u_char) get_char(vc, (u_short *) tmp, &tmp2); 756 buf[i] = (u_char) get_char(vc, (u_short *) tmp, &tmp2);
752 tmp += 2; 757 tmp += 2;
@@ -811,7 +816,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to,
811 u_short saved_punc_mask = spk_punc_mask; 816 u_short saved_punc_mask = spk_punc_mask;
812 817
813 spk_old_attr = spk_attr; 818 spk_old_attr = spk_attr;
814 spk_attr = get_attributes((u_short *) from); 819 spk_attr = get_attributes(vc, (u_short *)from);
815 while (from < to) { 820 while (from < to) {
816 buf[i++] = (char)get_char(vc, (u_short *) from, &tmp); 821 buf[i++] = (char)get_char(vc, (u_short *) from, &tmp);
817 from += 2; 822 from += 2;
@@ -886,7 +891,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
886 sentmarks[bn][0] = &sentbuf[bn][0]; 891 sentmarks[bn][0] = &sentbuf[bn][0];
887 i = 0; 892 i = 0;
888 spk_old_attr = spk_attr; 893 spk_old_attr = spk_attr;
889 spk_attr = get_attributes((u_short *) start); 894 spk_attr = get_attributes(vc, (u_short *)start);
890 895
891 while (start < end) { 896 while (start < end) {
892 sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp); 897 sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp);
@@ -1585,7 +1590,7 @@ static int count_highlight_color(struct vc_data *vc)
1585 u16 *ptr; 1590 u16 *ptr;
1586 1591
1587 for (ptr = start; ptr < end; ptr++) { 1592 for (ptr = start; ptr < end; ptr++) {
1588 ch = get_attributes(ptr); 1593 ch = get_attributes(vc, ptr);
1589 bg = (ch & 0x70) >> 4; 1594 bg = (ch & 0x70) >> 4;
1590 speakup_console[vc_num]->ht.bgcount[bg]++; 1595 speakup_console[vc_num]->ht.bgcount[bg]++;
1591 } 1596 }
diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index 3b5835b28128..a5bbb338f275 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,11 @@
6#include "spk_priv.h" 6#include "spk_priv.h"
7#include "serialio.h" 7#include "serialio.h"
8 8
9#include <linux/serial_core.h>
10/* WARNING: Do not change this to <linux/serial.h> without testing that
11 * SERIAL_PORT_DFNS does get defined to the appropriate value. */
12#include <asm/serial.h>
13
9#ifndef SERIAL_PORT_DFNS 14#ifndef SERIAL_PORT_DFNS
10#define SERIAL_PORT_DFNS 15#define SERIAL_PORT_DFNS
11#endif 16#endif
@@ -23,9 +28,15 @@ const struct old_serial_port *spk_serial_init(int index)
23 int baud = 9600, quot = 0; 28 int baud = 9600, quot = 0;
24 unsigned int cval = 0; 29 unsigned int cval = 0;
25 int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8; 30 int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
26 const struct old_serial_port *ser = rs_table + index; 31 const struct old_serial_port *ser;
27 int err; 32 int err;
28 33
34 if (index >= ARRAY_SIZE(rs_table)) {
35 pr_info("no port info for ttyS%d\n", index);
36 return NULL;
37 }
38 ser = rs_table + index;
39
29 /* Divisor, bytesize and parity */ 40 /* Divisor, bytesize and parity */
30 quot = ser->baud_base / baud; 41 quot = ser->baud_base / baud;
31 cval = cflag & (CSIZE | CSTOPB); 42 cval = cflag & (CSIZE | CSTOPB);
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index e7cbc44eef57..bd51bdd0a7bf 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4250,6 +4250,7 @@ unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed)
4250{ 4250{
4251 return screenpos(vc, 2 * w_offset, viewed); 4251 return screenpos(vc, 2 * w_offset, viewed);
4252} 4252}
4253EXPORT_SYMBOL_GPL(screen_pos);
4253 4254
4254void getconsxy(struct vc_data *vc, unsigned char *p) 4255void getconsxy(struct vc_data *vc, unsigned char *p)
4255{ 4256{