linux-stable/drivers/misc/eeprom
Kees Cook a6501e4b38 eeprom: at25: Restore missing allocation
The at25 driver regressed in v5.17-rc1 due to a broken conflict
resolution: the allocation of the object was accidentally removed. Restore
it.

This was found when building under CONFIG_FORTIFY_SOURCE=y and
-Warray-bounds, which complained about strncpy() being used against an
empty object:

In function 'strncpy',
    inlined from 'at25_fw_to_chip.constprop' at drivers/misc/eeprom/at25.c:312:2:
./include/linux/fortify-string.h:48:33: warning: '__builtin_strncpy' offset [0, 9] is out of the bounds [0, 0] [-Warray-bounds]
   48 | #define __underlying_strncpy    __builtin_strncpy
      |                                 ^
./include/linux/fortify-string.h:59:16: note: in expansion of macro '__underlying_strncpy'
   59 |         return __underlying_strncpy(p, q, size);
      |                ^~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'at25_fram_to_chip' at drivers/misc/eeprom/at25.c:373:2,
    inlined from 'at25_probe' at drivers/misc/eeprom/at25.c:453:10:
./include/linux/fortify-string.h:48:33: warning: '__builtin_strncpy' offset [0, 9] is out of the bounds [0, 0] [-Warray-bounds]
   48 | #define __underlying_strncpy    __builtin_strncpy
      |                                 ^
./include/linux/fortify-string.h:59:16: note: in expansion of macro '__underlying_strncpy'
   59 |         return __underlying_strncpy(p, q, size);
      |                ^~~~~~~~~~~~~~~~~~~~

Link: https://lore.kernel.org/lkml/CAHp75VdqK7h63fz-cPaQ2MGaVdaR2f1Fb5kKCZidUG3RwLsAVA@mail.gmail.com/
Fixes: af40d16042 ("Merge v5.15-rc5 into char-misc-next")
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jiri Prchal <jiri.prchal@aksignal.cz>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220118182003.3385019-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-22 13:32:48 +01:00
..
at24.c eeprom: at24: Add support for 24c1025 EEPROM 2021-12-13 14:42:39 +01:00
at25.c eeprom: at25: Restore missing allocation 2022-01-22 13:32:48 +01:00
digsy_mtc_eeprom.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ee1004.c eeprom: ee1004: Remove not needed debug message 2021-06-04 15:28:27 +02:00
eeprom.c misc: eeprom: use helper to get i2c_client from kobj 2020-09-21 11:45:43 +02:00
eeprom_93cx6.c misc: eeprom: eeprom_93cx6: Repair function arg descriptions 2020-06-29 18:45:52 +02:00
eeprom_93xx46.c eeprom: 93xx46: fix MODULE_DEVICE_TABLE 2021-10-15 10:54:02 +02:00
idt_89hpesx.c eeprom: idt_89hpesx: use SPDX-License-Identifier 2021-06-09 18:39:40 +02:00
Kconfig nvmem: prepare basics for FRAM support 2021-06-11 12:23:10 +02:00
Makefile eeprom: New ee1004 driver for DDR4 memory 2018-10-15 20:51:46 +02:00
max6875.c misc: eeprom: max6875: convert to i2c_new_dummy_device 2019-07-25 10:06:54 +02:00