linux/drivers/staging/greybus
Arnd Bergmann 18f44de63f staging: greybus: change strncpy() to strscpy_pad()
gcc-10 warns about a strncpy() that does not enforce zero-termination:

In file included from include/linux/string.h:369,
                 from drivers/staging/greybus/fw-management.c:9:
In function 'strncpy',
    inlined from 'fw_mgmt_backend_fw_update_operation' at drivers/staging/greybus/fw-management.c:306:2:
include/linux/fortify-string.h:108:30: error: '__builtin_strncpy' specified bound 10 equals destination size [-Werror=stringop-truncation]
  108 | #define __underlying_strncpy __builtin_strncpy
      |                              ^
include/linux/fortify-string.h:187:9: note: in expansion of macro '__underlying_strncpy'
  187 |  return __underlying_strncpy(p, q, size);
      |         ^~~~~~~~~~~~~~~~~~~~

For some reason, I cannot reproduce this with gcc-9 or gcc-11, and I only
get a warning for one of the four related strncpy()s, so I'm not
sure what's going on.

Change all four to strscpy_pad(), which is the safest replacement here,
as it avoids ending up with uninitialized stack data in the tag name.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Link: https://github.com/KSPP/linux/issues/90 [1]
Link: https://lore.kernel.org/r/20240408194821.3183462-3-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-09 17:53:50 +02:00
..
Documentation
arche-apb-ctrl.c greybus: arche-ctrl: move device table to its right location 2024-04-09 17:51:31 +02:00
arche-platform.c greybus: arche-ctrl: move device table to its right location 2024-04-09 17:51:31 +02:00
arche_platform.h
audio_apbridgea.c
audio_apbridgea.h greybus: audio: apbridgea: Remove flexible array from struct audio_apbridgea_hdr 2024-03-05 13:59:14 +00:00
audio_codec.c staging: greybus: Avoid abusing controls_rwsem 2023-07-20 10:02:59 +02:00
audio_codec.h staging: greybus: Avoid abusing controls_rwsem 2023-07-20 10:02:59 +02:00
audio_gb.c
audio_helper.c staging: greybus: audio_helper: Use snd_ctl_remove_id() 2023-07-20 10:00:39 +02:00
audio_helper.h
audio_manager.c staging: greybus: Remove usage of the deprecated ida_simple_xx() API 2024-01-24 10:18:12 -08:00
audio_manager.h
audio_manager_module.c staging: greybus: Constify gb_audio_module_type 2024-03-25 18:25:45 +01:00
audio_manager_private.h staging: greybus: Modify lines end with a '(' 2023-10-17 15:42:27 +02:00
audio_manager_sysfs.c
audio_module.c
audio_topology.c staging: greybus: Remove redundant variable 'mask' 2024-03-05 13:59:28 +00:00
authentication.c staging: greybus: Remove usage of the deprecated ida_simple_xx() API 2024-01-24 10:18:12 -08:00
bootrom.c greybus: Avoid fake flexible array for response data 2024-03-05 13:59:43 +00:00
camera.c staging: greybus: Replace gcam macros with direct dev log calls 2024-04-09 17:52:32 +02:00
firmware.h
fw-core.c staging: greybus: fix alignment of open parenthesis 2023-08-22 15:47:55 +02:00
fw-download.c greybus: Avoid fake flexible array for response data 2024-03-05 13:59:43 +00:00
fw-management.c staging: greybus: change strncpy() to strscpy_pad() 2024-04-09 17:53:50 +02:00
gb-camera.h
gbphy.c staging: greybus: Remove usage of the deprecated ida_simple_xx() API 2024-01-24 10:18:12 -08:00
gbphy.h
gpio.c staging: greybus: Inline gpio_chip_to_gb_gpio_controller() 2023-03-25 09:54:52 +01:00
greybus_authentication.h staging: greybus: Replace __attribute__((packed)) by __packed in various instances 2024-03-07 21:40:52 +00:00
greybus_firmware.h staging: greybus: Replaces directive __attribute__((packed)) by __packed as suggested by checkpatch 2024-03-07 21:40:52 +00:00
hid.c
i2c.c staging: greybus: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
Kconfig leds: Make flash and multicolor dependencies unconditional 2024-03-07 08:48:03 +00:00
light.c greybus: lights: check return of get_channel_from_mode 2024-03-26 09:26:47 +01:00
log.c
loopback.c staging: greybus: Add blank line after struct declaration 2024-03-25 18:25:47 +01:00
Makefile
power_supply.c
pwm.c staging: greybus: pwm: Make use of devm_pwmchip_alloc() function 2024-02-22 14:39:29 +01:00
raw.c staging: greybus: Remove usage of the deprecated ida_simple_xx() API 2024-01-24 10:18:12 -08:00
sdio.c
spi.c
spilib.c staging: greybus: spi: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:55 +00:00
spilib.h
TODO
uart.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
usb.c
vibrator.c staging: greybus: Remove usage of the deprecated ida_simple_xx() API 2024-01-24 10:18:12 -08:00