platform.c (a7989cd65d51a65fff3d149c13c9640814fd93ee) platform.c (57d9a2ef6d7f85efdb89ba084af620a318b741e2)
1/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
1/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2#include <libpldm/base.h>
2#include <libpldm/platform.h>
3#include <libpldm/oem/ibm/platform.h>
4
5#include <string.h>
6
7LIBPLDM_ABI_STABLE
8int encode_bios_attribute_update_event_req(uint8_t instance_id,
9 uint8_t format_version, uint8_t tid,

--- 9 unchanged lines hidden (view full) ---

19 if (msg == NULL || list_of_handles == NULL) {
20 return PLDM_ERROR_INVALID_DATA;
21 }
22
23 if (num_handles == 0) {
24 return PLDM_ERROR_INVALID_DATA;
25 }
26
3#include <libpldm/platform.h>
4#include <libpldm/oem/ibm/platform.h>
5
6#include <string.h>
7
8LIBPLDM_ABI_STABLE
9int encode_bios_attribute_update_event_req(uint8_t instance_id,
10 uint8_t format_version, uint8_t tid,

--- 9 unchanged lines hidden (view full) ---

20 if (msg == NULL || list_of_handles == NULL) {
21 return PLDM_ERROR_INVALID_DATA;
22 }
23
24 if (num_handles == 0) {
25 return PLDM_ERROR_INVALID_DATA;
26 }
27
27 if (payload_length !=
28 (PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES + sizeof(num_handles) +
29 (num_handles * sizeof(uint16_t)))) {
28 if (SIZE_MAX / num_handles < sizeof(uint16_t)) {
30 return PLDM_ERROR_INVALID_LENGTH;
31 }
32
29 return PLDM_ERROR_INVALID_LENGTH;
30 }
31
32 if (payload_length <
33 PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES + sizeof(num_handles)) {
34 return PLDM_ERROR_INVALID_LENGTH;
35 }
36
37 if (payload_length - (PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
38 sizeof(num_handles)) <
39 num_handles * sizeof(uint16_t)) {
40 return PLDM_ERROR_INVALID_LENGTH;
41 }
42
33 struct pldm_header_info header = { 0 };
34 header.msg_type = PLDM_REQUEST;
35 header.instance = instance_id;
36 header.pldm_type = PLDM_PLATFORM;
37 header.command = PLDM_PLATFORM_EVENT_MESSAGE;
38 uint8_t rc = pack_pldm_header(&header, &(msg->hdr));
39 if (rc != PLDM_SUCCESS) {
40 return rc;

--- 13 unchanged lines hidden ---
43 struct pldm_header_info header = { 0 };
44 header.msg_type = PLDM_REQUEST;
45 header.instance = instance_id;
46 header.pldm_type = PLDM_PLATFORM;
47 header.command = PLDM_PLATFORM_EVENT_MESSAGE;
48 uint8_t rc = pack_pldm_header(&header, &(msg->hdr));
49 if (rc != PLDM_SUCCESS) {
50 return rc;

--- 13 unchanged lines hidden ---