array-bounds fixes for 5.14-rc1

Hi Linus,
 
 Please, pull the following patch that fixes an out-of-bounds
 warning in the media subsystem. This is part of the ongoing
 efforts to globally enable -Warray-bounds.
 
 Thanks!
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkmRahXBSurMIg1YvRwW0y0cG2zEFAmDaPFoACgkQRwW0y0cG
 2zGrww/7BPIdq+9Q6ScoXAp7piEDXv8+y2QoEGYHVrssQhN/qSLLv3HIakhQkVZV
 2kmx7Fien26yRyEEAdi9N9CZNGjc0/V+0DthexPxaNNF6Jl+pw+XMC9/MDS0r+TX
 97cc8cBUjydToOlLpPaWV8wewuRDAukzGMoXBZK7ovkv7Kfm1HB6MOtwKUtyrEse
 ydSZqD1LBW8ThRTD0bvHbOh91K/xBj8ECoZ7y9ZoRjTvhD5AOnyERIr818KZNVVo
 1qHALwigDkomt1WdS/qiY0r0lmaM7vUzX+qYcqXmfQ3cV2NUooIkcDBL8vjd1r7f
 gOJDcupel6JAfiBbFcIzLdnHIqbRKP1qpOmz9GyZXnQg1J9F/bdqNbZNfTBn4FQj
 4BnI28reVlorGwoZCVlGgbNy8Ht2Aa/td/48+/XJM+T0NpTE6wDXytQSDbFN7HoL
 NkNWvtUiB7aOzGnYFxEK9pRRFkMGaFW4M3AEbb8JMO+31k4j/ZmUVPyp5hN3gLZ7
 37vYN3qojVtICHYXJw+ovej0A/66d4h24iizeu/G6puxq2CCH7+9NIdhp8rQ5ELj
 4015/a1VypEkPrHi7res5viw3A0iQ65fNzAjlzlHcaK4mA+fH6Fqqvqe17Fti0uE
 59biGqTjvJJ0CmgL5h+jlKKDIw6akh3Xx8sEd0S7sYu9EclMTJE=
 =PfCd
 -----END PGP SIGNATURE-----

Merge tag 'array-bounds-fixes-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux

Pull array-bounds fixes from Gustavo Silva:
 "Fix an out-of-bounds warning in the media subsystem.

  This is part of the ongoing efforts to globally enable -Warray-bounds"

* tag 'array-bounds-fixes-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux:
  media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
This commit is contained in:
Linus Torvalds 2021-06-28 20:13:28 -07:00
commit e17c120f48
2 changed files with 11 additions and 15 deletions

View File

@ -908,7 +908,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
void *buffer, size_t size)
{
struct sms_firmware *firmware = (struct sms_firmware *) buffer;
struct sms_msg_data4 *msg;
struct sms_msg_data5 *msg;
u32 mem_address, calc_checksum = 0;
u32 i, *ptr;
u8 *payload = firmware->payload;
@ -989,24 +989,20 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
goto exit_fw_download;
if (coredev->mode == DEVICE_MODE_NONE) {
struct sms_msg_data *trigger_msg =
(struct sms_msg_data *) msg;
pr_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ\n");
SMS_INIT_MSG(&msg->x_msg_header,
MSG_SMS_SWDOWNLOAD_TRIGGER_REQ,
sizeof(struct sms_msg_hdr) +
sizeof(u32) * 5);
sizeof(*msg));
trigger_msg->msg_data[0] = firmware->start_address;
msg->msg_data[0] = firmware->start_address;
/* Entry point */
trigger_msg->msg_data[1] = 6; /* Priority */
trigger_msg->msg_data[2] = 0x200; /* Stack size */
trigger_msg->msg_data[3] = 0; /* Parameter */
trigger_msg->msg_data[4] = 4; /* Task ID */
msg->msg_data[1] = 6; /* Priority */
msg->msg_data[2] = 0x200; /* Stack size */
msg->msg_data[3] = 0; /* Parameter */
msg->msg_data[4] = 4; /* Task ID */
rc = smscore_sendrequest_and_wait(coredev, trigger_msg,
trigger_msg->x_msg_header.msg_length,
rc = smscore_sendrequest_and_wait(coredev, msg,
msg->x_msg_header.msg_length,
&coredev->trigger_done);
} else {
SMS_INIT_MSG(&msg->x_msg_header, MSG_SW_RELOAD_EXEC_REQ,

View File

@ -624,9 +624,9 @@ struct sms_msg_data2 {
u32 msg_data[2];
};
struct sms_msg_data4 {
struct sms_msg_data5 {
struct sms_msg_hdr x_msg_header;
u32 msg_data[4];
u32 msg_data[5];
};
struct sms_data_download {