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.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:
"A few more fixes for the input subsystem:

- restore naming for tsc2005 touchscreens as some userspace match on it
- fix out of bound access in legacy keyboard driver
- fixup in RMI4 driver

Everything is tagged for stable as well"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: tsc200x - report proper input_dev name
tty/vt/keyboard: fix OOB access in do_compute_shiftstate()
Input: synaptics-rmi4 - fix maximum size check for F12 control register 8

+39 -31
+5 -4
drivers/input/rmi4/rmi_f12.c
··· 66 66 struct rmi_device *rmi_dev = fn->rmi_dev; 67 67 int ret; 68 68 int offset; 69 - u8 buf[14]; 69 + u8 buf[15]; 70 70 int pitch_x = 0; 71 71 int pitch_y = 0; 72 72 int clip_x_low = 0; ··· 86 86 87 87 offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8); 88 88 89 - if (item->reg_size > 14) { 90 - dev_err(&fn->dev, "F12 control8 should be 14 bytes, not: %ld\n", 91 - item->reg_size); 89 + if (item->reg_size > sizeof(buf)) { 90 + dev_err(&fn->dev, 91 + "F12 control8 should be no bigger than %zd bytes, not: %ld\n", 92 + sizeof(buf), item->reg_size); 92 93 return -ENODEV; 93 94 } 94 95
+6 -1
drivers/input/touchscreen/tsc2004.c
··· 22 22 #include <linux/regmap.h> 23 23 #include "tsc200x-core.h" 24 24 25 + static const struct input_id tsc2004_input_id = { 26 + .bustype = BUS_I2C, 27 + .product = 2004, 28 + }; 29 + 25 30 static int tsc2004_cmd(struct device *dev, u8 cmd) 26 31 { 27 32 u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; ··· 47 42 const struct i2c_device_id *id) 48 43 49 44 { 50 - return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C, 45 + return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id, 51 46 devm_regmap_init_i2c(i2c, &tsc200x_regmap_config), 52 47 tsc2004_cmd); 53 48 }
+6 -1
drivers/input/touchscreen/tsc2005.c
··· 24 24 #include <linux/regmap.h> 25 25 #include "tsc200x-core.h" 26 26 27 + static const struct input_id tsc2005_input_id = { 28 + .bustype = BUS_SPI, 29 + .product = 2005, 30 + }; 31 + 27 32 static int tsc2005_cmd(struct device *dev, u8 cmd) 28 33 { 29 34 u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; ··· 67 62 if (error) 68 63 return error; 69 64 70 - return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI, 65 + return tsc200x_probe(&spi->dev, spi->irq, &tsc2005_input_id, 71 66 devm_regmap_init_spi(spi, &tsc200x_regmap_config), 72 67 tsc2005_cmd); 73 68 }
+12 -3
drivers/input/touchscreen/tsc200x-core.c
··· 450 450 mutex_unlock(&ts->mutex); 451 451 } 452 452 453 - int tsc200x_probe(struct device *dev, int irq, __u16 bustype, 453 + int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, 454 454 struct regmap *regmap, 455 455 int (*tsc200x_cmd)(struct device *dev, u8 cmd)) 456 456 { ··· 547 547 snprintf(ts->phys, sizeof(ts->phys), 548 548 "%s/input-ts", dev_name(dev)); 549 549 550 - input_dev->name = "TSC200X touchscreen"; 550 + if (tsc_id->product == 2004) { 551 + input_dev->name = "TSC200X touchscreen"; 552 + } else { 553 + input_dev->name = devm_kasprintf(dev, GFP_KERNEL, 554 + "TSC%04d touchscreen", 555 + tsc_id->product); 556 + if (!input_dev->name) 557 + return -ENOMEM; 558 + } 559 + 551 560 input_dev->phys = ts->phys; 552 - input_dev->id.bustype = bustype; 561 + input_dev->id = *tsc_id; 553 562 input_dev->dev.parent = dev; 554 563 input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); 555 564 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+1 -1
drivers/input/touchscreen/tsc200x-core.h
··· 70 70 extern const struct regmap_config tsc200x_regmap_config; 71 71 extern const struct dev_pm_ops tsc200x_pm_ops; 72 72 73 - int tsc200x_probe(struct device *dev, int irq, __u16 bustype, 73 + int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, 74 74 struct regmap *regmap, 75 75 int (*tsc200x_cmd)(struct device *dev, u8 cmd)); 76 76 int tsc200x_remove(struct device *dev);
+9 -21
drivers/tty/vt/keyboard.c
··· 366 366 367 367 static void do_compute_shiftstate(void) 368 368 { 369 - unsigned int i, j, k, sym, val; 369 + unsigned int k, sym, val; 370 370 371 371 shift_state = 0; 372 372 memset(shift_down, 0, sizeof(shift_down)); 373 373 374 - for (i = 0; i < ARRAY_SIZE(key_down); i++) { 375 - 376 - if (!key_down[i]) 374 + for_each_set_bit(k, key_down, min(NR_KEYS, KEY_CNT)) { 375 + sym = U(key_maps[0][k]); 376 + if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK) 377 377 continue; 378 378 379 - k = i * BITS_PER_LONG; 379 + val = KVAL(sym); 380 + if (val == KVAL(K_CAPSSHIFT)) 381 + val = KVAL(K_SHIFT); 380 382 381 - for (j = 0; j < BITS_PER_LONG; j++, k++) { 382 - 383 - if (!test_bit(k, key_down)) 384 - continue; 385 - 386 - sym = U(key_maps[0][k]); 387 - if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK) 388 - continue; 389 - 390 - val = KVAL(sym); 391 - if (val == KVAL(K_CAPSSHIFT)) 392 - val = KVAL(K_SHIFT); 393 - 394 - shift_down[val]++; 395 - shift_state |= (1 << val); 396 - } 383 + shift_down[val]++; 384 + shift_state |= BIT(val); 397 385 } 398 386 } 399 387