gpio: fixes for v6.4-rc6

- fix a memory corruption bug in gpio-sim
 - fix inconsistencies in user-space configuration of gpio-sim
 - make Andy Shevchenko a reviewer for the GPIO subsystem
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmSDOaEACgkQEacuoBRx
 13KlgQ/+M0154lzMnynfwK7UjCVhXrpeTvwvy+Lxl6rUOUwLAvf91RO6nKC838/m
 XEqYIZ2gbWEbgVGQnSKAJFy8B0boso54DE0R/zQ3mkmiSsZmWhET7rCWtJCGkIDC
 M7BJmYnLbTwlveI5FFAl+AMGH1RWDljubgEwqnCX2RbJFwz3DVAAn8o+tZWu1Wm4
 GUAgu8vEggM6idk0TolrCr/Tuic+T8QpGU1P3I2PA05G6t746dpMCDKg6W5M7N4F
 gKARLMsf1FOcQAA+AcTnu8XzbWaYrm/HUR3I+BtnBKLdB8EFYzTC7gamKtlbiUVj
 ReM1P9L71P/oHG+64smH+NViI4poVeaWArNDP3zxvLvWe+flNS22vomEvVKo+q8H
 9a2dS5a4HU3ZTUlVpIzVvM+52JY2cKk2c+KvvDTYU49AMsccAHkfLE3Qsw2JmzIj
 dX5I/3HiYYraM7Pe5xS0xlbJk9hekSXT35yoIJDdH2pmZwORqzgd4nkBoXF7dyS1
 S1NfABdyfdy3LpuoqEvspvv/0HJqba1y8/IaRBbJsn9mj5uvNSmzxKUGjbZUzQfB
 OvUVynJD5Ac7qsnFo5QxCP0AuXFIF96P1tf44rGmZBd2Pw+MeOEiiS+yvLNNd/wM
 SetlMHnZW+X/YorvWfVp5vUS1+Rw2LuPQPBWBjC/YIABJ1JC3Ks=
 =DFOg
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v6.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:
 "Two fixes for the GPIO testing module and one commit making Andy a
  reviewer for the GPIO subsystem:

   - fix a memory corruption bug in gpio-sim

   - fix inconsistencies in user-space configuration of gpio-sim

   - make Andy Shevchenko a reviewer for the GPIO subsystem"

* tag 'gpio-fixes-for-v6.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  MAINTAINERS: add Andy Shevchenko as reviewer for the GPIO subsystem
  gpio: sim: quietly ignore configured lines outside the bank
  gpio: sim: fix memory corruption when adding named lines and unnamed hogs
This commit is contained in:
Linus Torvalds 2023-06-09 09:17:25 -07:00
commit 92d22212c0
2 changed files with 17 additions and 2 deletions

View File

@ -8799,6 +8799,7 @@ F: include/linux/gpio/regmap.h
GPIO SUBSYSTEM
M: Linus Walleij <linus.walleij@linaro.org>
M: Bartosz Golaszewski <brgl@bgdev.pl>
R: Andy Shevchenko <andy@kernel.org>
L: linux-gpio@vger.kernel.org
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git

View File

@ -696,6 +696,9 @@ static char **gpio_sim_make_line_names(struct gpio_sim_bank *bank,
char **line_names;
list_for_each_entry(line, &bank->line_list, siblings) {
if (line->offset >= bank->num_lines)
continue;
if (line->name) {
if (line->offset > max_offset)
max_offset = line->offset;
@ -721,8 +724,13 @@ static char **gpio_sim_make_line_names(struct gpio_sim_bank *bank,
if (!line_names)
return ERR_PTR(-ENOMEM);
list_for_each_entry(line, &bank->line_list, siblings)
line_names[line->offset] = line->name;
list_for_each_entry(line, &bank->line_list, siblings) {
if (line->offset >= bank->num_lines)
continue;
if (line->name && (line->offset <= max_offset))
line_names[line->offset] = line->name;
}
return line_names;
}
@ -754,6 +762,9 @@ static int gpio_sim_add_hogs(struct gpio_sim_device *dev)
list_for_each_entry(bank, &dev->bank_list, siblings) {
list_for_each_entry(line, &bank->line_list, siblings) {
if (line->offset >= bank->num_lines)
continue;
if (line->hog)
num_hogs++;
}
@ -769,6 +780,9 @@ static int gpio_sim_add_hogs(struct gpio_sim_device *dev)
list_for_each_entry(bank, &dev->bank_list, siblings) {
list_for_each_entry(line, &bank->line_list, siblings) {
if (line->offset >= bank->num_lines)
continue;
if (!line->hog)
continue;