dsp: platform: Fix location of closing paren in overflow detection
I suspect this was the result of editor auto-parenthesis support and the
result got overlooked.
Add some tests while we're in the area.
As seems to be the case when we expand the tests associated with
argument values, also update the ABI dump to reflect the change in
recorded register allocation.
gitlint-ignore: UC1
Fixes: #13
Fixes: ad33b99abcc4 ("dsp: platform: Bounds check encode_state_effecter_pdr()")
Reported-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Change-Id: Iab4c1c337400678ac424936151a38baf0e0d554d
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 22f7ddb..9d83b38 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,16 @@
- Fixed
- Security
+## [Unreleased]
+
+### Changed
+
+1. Register assignment for parameters of `encode_state_effecter_pdr()`
+
+### Fixed
+
+1. dsp: platform: Fix location of closing paren in overflow detection
+
## [0.10.0] 2024-11-01
### Added
diff --git a/abi/x86_64/gcc.dump b/abi/x86_64/gcc.dump
index f3f7a40..8836379 100644
--- a/abi/x86_64/gcc.dump
+++ b/abi/x86_64/gcc.dump
@@ -7162,7 +7162,7 @@
'Param' => {
'0' => {
'name' => 'effecter',
- 'type' => '191555'
+ 'type' => '191775'
},
'1' => {
'name' => 'allocation_size',
@@ -7170,7 +7170,7 @@
},
'2' => {
'name' => 'possible_states',
- 'type' => '191565'
+ 'type' => '191785'
},
'3' => {
'name' => 'possible_states_size',
@@ -7184,20 +7184,20 @@
'Reg' => {
'0' => 'rdi',
'1' => 'rsi',
- '2' => 'rdx',
+ '2' => 'r9',
'3' => 'rcx',
'4' => 'r8'
},
'Return' => '100',
'ShortName' => 'encode_state_effecter_pdr'
},
- '194960' => {
+ '195180' => {
'Header' => 'instance-id.h',
'Line' => '85',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '195140'
+ 'type' => '195360'
},
'1' => {
'name' => 'tid',
@@ -7211,13 +7211,13 @@
'Return' => '100',
'ShortName' => 'pldm_instance_id_free'
},
- '195145' => {
+ '195365' => {
'Header' => 'instance-id.h',
'Line' => '68',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '195140'
+ 'type' => '195360'
},
'1' => {
'name' => 'tid',
@@ -7225,19 +7225,19 @@
},
'2' => {
'name' => 'iid',
- 'type' => '195527'
+ 'type' => '195747'
}
},
'Return' => '100',
'ShortName' => 'pldm_instance_id_alloc'
},
- '195532' => {
+ '195752' => {
'Header' => 'instance-id.h',
'Line' => '51',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '195140'
+ 'type' => '195360'
}
},
'Reg' => {
@@ -7246,25 +7246,25 @@
'Return' => '100',
'ShortName' => 'pldm_instance_db_destroy'
},
- '195617' => {
+ '195837' => {
'Header' => 'instance-id.h',
'Line' => '41',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '195703'
+ 'type' => '195923'
}
},
'Return' => '100',
'ShortName' => 'pldm_instance_db_init_default'
},
- '195708' => {
+ '195928' => {
'Header' => 'instance-id.h',
'Line' => '28',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '195703'
+ 'type' => '195923'
},
'1' => {
'name' => 'dbpath',
@@ -7274,13 +7274,13 @@
'Return' => '100',
'ShortName' => 'pldm_instance_db_init'
},
- '196659' => {
+ '196879' => {
'Header' => 'transport.h',
'Line' => '53',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'name' => 'tid',
@@ -7301,16 +7301,16 @@
'2' => 'rdx',
'3' => 'rcx'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_transport_send_msg'
},
- '196706' => {
+ '196926' => {
'Header' => 'transport.h',
'Line' => '118',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'name' => 'tid',
@@ -7336,16 +7336,16 @@
'Reg' => {
'2' => 'r14'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_transport_send_recv_msg'
},
- '196763' => {
+ '196983' => {
'Header' => 'mctp-demux.h',
'Line' => '18',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '196654'
+ 'type' => '196874'
}
},
'Reg' => {
@@ -7354,17 +7354,17 @@
'Return' => '1',
'ShortName' => 'pldm_transport_mctp_demux_destroy'
},
- '196800' => {
+ '197020' => {
'Header' => 'transport.h',
'Line' => '81',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'name' => 'tid',
- 'type' => '196837'
+ 'type' => '197057'
},
'2' => {
'name' => 'pldm_msg',
@@ -7381,16 +7381,16 @@
'2' => 'rbp',
'3' => 'rcx'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_transport_recv_msg'
},
- '196842' => {
+ '197062' => {
'Header' => 'mctp-demux.h',
'Line' => '32',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '196654'
+ 'type' => '196874'
},
'1' => {
'name' => 'tid',
@@ -7398,7 +7398,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
}
},
'Reg' => {
@@ -7409,28 +7409,28 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_map_tid'
},
- '196874' => {
+ '197094' => {
'Header' => 'mctp-demux.h',
'Line' => '22',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '196654'
+ 'type' => '196874'
}
},
'Reg' => {
'0' => 'rdi'
},
- 'Return' => '196696',
+ 'Return' => '196916',
'ShortName' => 'pldm_transport_mctp_demux_core'
},
- '196918' => {
+ '197138' => {
'Header' => 'mctp-demux.h',
'Line' => '15',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '196940'
+ 'type' => '197160'
}
},
'Reg' => {
@@ -7439,19 +7439,19 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_init'
},
- '196999' => {
+ '197219' => {
'Header' => 'pldm.h',
'Line' => '119',
'Return' => '1',
'ShortName' => 'pldm_close'
},
- '197043' => {
+ '197263' => {
'Header' => 'pldm.h',
'Line' => '75',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
},
'1' => {
'name' => 'mctp_fd',
@@ -7472,16 +7472,16 @@
'2' => 'rdx',
'3' => 'rcx'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_send'
},
- '197462' => {
+ '197682' => {
'Header' => 'pldm.h',
'Line' => '57',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
},
'1' => {
'name' => 'mctp_fd',
@@ -7512,16 +7512,16 @@
'4' => 'r8',
'5' => 'r9'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_send_recv'
},
- '197945' => {
+ '198165' => {
'Header' => 'pldm.h',
'Line' => '94',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
},
'1' => {
'name' => 'mctp_fd',
@@ -7543,16 +7543,16 @@
'Reg' => {
'3' => 'rbx'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_recv'
},
- '198171' => {
+ '198391' => {
'Header' => 'pldm.h',
'Line' => '112',
'Param' => {
'0' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
},
'1' => {
'name' => 'mctp_fd',
@@ -7571,26 +7571,26 @@
'2' => 'r12',
'3' => 'r13'
},
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_recv_any'
},
- '198624' => {
+ '198844' => {
'Header' => 'pldm.h',
'Line' => '39',
- 'Return' => '196610',
+ 'Return' => '196830',
'ShortName' => 'pldm_open'
},
- '201042' => {
+ '201262' => {
'Header' => 'af-mctp.h',
'Line' => '54',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '201198'
+ 'type' => '201418'
},
'1' => {
'name' => 'smctp',
- 'type' => '201203'
+ 'type' => '201423'
},
'2' => {
'name' => 'len',
@@ -7604,13 +7604,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_bind'
},
- '201208' => {
+ '201428' => {
'Header' => 'af-mctp.h',
'Line' => '19',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201198'
+ 'type' => '201418'
}
},
'Reg' => {
@@ -7619,13 +7619,13 @@
'Return' => '1',
'ShortName' => 'pldm_transport_af_mctp_destroy'
},
- '201292' => {
+ '201512' => {
'Header' => 'af-mctp.h',
'Line' => '16',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201516'
+ 'type' => '201736'
}
},
'Reg' => {
@@ -7634,13 +7634,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_init'
},
- '202703' => {
+ '202923' => {
'Header' => 'af-mctp.h',
'Line' => '37',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201198'
+ 'type' => '201418'
},
'1' => {
'name' => 'tid',
@@ -7648,7 +7648,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
}
},
'Reg' => {
@@ -7659,13 +7659,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_unmap_tid'
},
- '202776' => {
+ '202996' => {
'Header' => 'af-mctp.h',
'Line' => '33',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201198'
+ 'type' => '201418'
},
'1' => {
'name' => 'tid',
@@ -7673,7 +7673,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
}
},
'Reg' => {
@@ -7684,17 +7684,17 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_map_tid'
},
- '203017' => {
+ '203237' => {
'Header' => 'af-mctp.h',
'Line' => '28',
'Param' => {
'0' => {
'name' => 't',
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'name' => 'pollfd',
- 'type' => '199694'
+ 'type' => '199914'
}
},
'Reg' => {
@@ -7704,28 +7704,28 @@
'Return' => '100',
'ShortName' => 'pldm_transport_af_mctp_init_pollfd'
},
- '203095' => {
+ '203315' => {
'Header' => 'af-mctp.h',
'Line' => '23',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '201198'
+ 'type' => '201418'
}
},
'Reg' => {
'0' => 'rdi'
},
- 'Return' => '196696',
+ 'Return' => '196916',
'ShortName' => 'pldm_transport_af_mctp_core'
},
- '206814' => {
+ '207034' => {
'Header' => 'mctp-demux.h',
'Line' => '36',
'Param' => {
'0' => {
'name' => 'ctx',
- 'type' => '196654'
+ 'type' => '196874'
},
'1' => {
'name' => 'tid',
@@ -7733,7 +7733,7 @@
},
'2' => {
'name' => 'eid',
- 'type' => '196495'
+ 'type' => '196715'
}
},
'Reg' => {
@@ -7744,17 +7744,17 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_unmap_tid'
},
- '207128' => {
+ '207348' => {
'Header' => 'mctp-demux.h',
'Line' => '27',
'Param' => {
'0' => {
'name' => 't',
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'name' => 'pollfd',
- 'type' => '199694'
+ 'type' => '199914'
}
},
'Reg' => {
@@ -7764,13 +7764,13 @@
'Return' => '100',
'ShortName' => 'pldm_transport_mctp_demux_init_pollfd'
},
- '214964' => {
+ '215184' => {
'Header' => 'transport.h',
'Line' => '31',
'Param' => {
'0' => {
'name' => 'transport',
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'name' => 'timeout',
@@ -7780,7 +7780,7 @@
'Return' => '100',
'ShortName' => 'pldm_transport_poll'
},
- '217163' => {
+ '217383' => {
'Header' => 'file_io.h',
'Line' => '912',
'Param' => {
@@ -7800,7 +7800,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_with_metadata_resp'
},
- '217363' => {
+ '217583' => {
'Header' => 'file_io.h',
'Line' => '898',
'Param' => {
@@ -7854,7 +7854,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_with_metadata_req'
},
- '217595' => {
+ '217815' => {
'Header' => 'file_io.h',
'Line' => '881',
'Param' => {
@@ -7879,7 +7879,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_with_metadata_resp'
},
- '217696' => {
+ '217916' => {
'Header' => 'file_io.h',
'Line' => '866',
'Param' => {
@@ -7929,7 +7929,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_with_metadata_req'
},
- '217993' => {
+ '218213' => {
'Header' => 'file_io.h',
'Line' => '824',
'Param' => {
@@ -7949,7 +7949,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_with_meta_data_resp'
},
- '218188' => {
+ '218408' => {
'Header' => 'file_io.h',
'Line' => '811',
'Param' => {
@@ -8003,7 +8003,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_with_meta_data_req'
},
- '218400' => {
+ '218620' => {
'Header' => 'file_io.h',
'Line' => '794',
'Param' => {
@@ -8028,7 +8028,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_with_meta_data_resp'
},
- '218496' => {
+ '218716' => {
'Header' => 'file_io.h',
'Line' => '781',
'Param' => {
@@ -8078,7 +8078,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_with_meta_data_req'
},
- '218793' => {
+ '219013' => {
'Header' => 'file_io.h',
'Line' => '741',
'Param' => {
@@ -8103,7 +8103,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_resp'
},
- '218894' => {
+ '219114' => {
'Header' => 'file_io.h',
'Line' => '730',
'Param' => {
@@ -8131,7 +8131,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_req'
},
- '219129' => {
+ '219349' => {
'Header' => 'file_io.h',
'Line' => '718',
'Param' => {
@@ -8151,7 +8151,7 @@
'Return' => '100',
'ShortName' => 'encode_file_ack_resp'
},
- '219319' => {
+ '219539' => {
'Header' => 'file_io.h',
'Line' => '706',
'Param' => {
@@ -8185,7 +8185,7 @@
'Return' => '100',
'ShortName' => 'decode_file_ack_req'
},
- '219461' => {
+ '219681' => {
'Header' => 'file_io.h',
'Line' => '675',
'Param' => {
@@ -8215,7 +8215,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_resp'
},
- '219576' => {
+ '219796' => {
'Header' => 'file_io.h',
'Line' => '661',
'Param' => {
@@ -8252,7 +8252,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_req'
},
- '219846' => {
+ '220066' => {
'Header' => 'file_io.h',
'Line' => '644',
'Param' => {
@@ -8280,7 +8280,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_resp'
},
- '220076' => {
+ '220296' => {
'Header' => 'file_io.h',
'Line' => '626',
'Param' => {
@@ -8319,7 +8319,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_req'
},
- '220238' => {
+ '220458' => {
'Header' => 'file_io.h',
'Line' => '590',
'Param' => {
@@ -8344,7 +8344,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_resp'
},
- '220339' => {
+ '220559' => {
'Header' => 'file_io.h',
'Line' => '579',
'Param' => {
@@ -8372,7 +8372,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_req'
},
- '220574' => {
+ '220794' => {
'Header' => 'file_io.h',
'Line' => '567',
'Param' => {
@@ -8392,7 +8392,7 @@
'Return' => '100',
'ShortName' => 'encode_new_file_resp'
},
- '220764' => {
+ '220984' => {
'Header' => 'file_io.h',
'Line' => '555',
'Param' => {
@@ -8426,7 +8426,7 @@
'Return' => '100',
'ShortName' => 'decode_new_file_req'
},
- '220906' => {
+ '221126' => {
'Header' => 'file_io.h',
'Line' => '523',
'Param' => {
@@ -8456,7 +8456,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_memory_resp'
},
- '221021' => {
+ '221241' => {
'Header' => 'file_io.h',
'Line' => '509',
'Param' => {
@@ -8498,7 +8498,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_memory_req'
},
- '221306' => {
+ '221526' => {
'Header' => 'file_io.h',
'Line' => '491',
'Param' => {
@@ -8526,7 +8526,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_by_type_memory_resp'
},
- '221536' => {
+ '221756' => {
'Header' => 'file_io.h',
'Line' => '473',
'Param' => {
@@ -8570,7 +8570,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_by_type_memory_req'
},
- '221713' => {
+ '221933' => {
'Header' => 'file_io.h',
'Line' => '435',
'Param' => {
@@ -8594,7 +8594,7 @@
'Return' => '100',
'ShortName' => 'encode_write_file_resp'
},
- '221928' => {
+ '222148' => {
'Header' => 'file_io.h',
'Line' => '422',
'Param' => {
@@ -8624,7 +8624,7 @@
'Return' => '100',
'ShortName' => 'decode_write_file_resp'
},
- '222038' => {
+ '222258' => {
'Header' => 'file_io.h',
'Line' => '410',
'Param' => {
@@ -8652,7 +8652,7 @@
'Return' => '100',
'ShortName' => 'encode_write_file_req'
},
- '222273' => {
+ '222493' => {
'Header' => 'file_io.h',
'Line' => '391',
'Param' => {
@@ -8690,7 +8690,7 @@
'Return' => '100',
'ShortName' => 'decode_write_file_req'
},
- '222428' => {
+ '222648' => {
'Header' => 'file_io.h',
'Line' => '377',
'Param' => {
@@ -8714,7 +8714,7 @@
'Return' => '100',
'ShortName' => 'encode_read_file_resp'
},
- '222643' => {
+ '222863' => {
'Header' => 'file_io.h',
'Line' => '359',
'Param' => {
@@ -8748,7 +8748,7 @@
'Return' => '100',
'ShortName' => 'decode_read_file_resp'
},
- '222779' => {
+ '222999' => {
'Header' => 'file_io.h',
'Line' => '344',
'Param' => {
@@ -8776,7 +8776,7 @@
'Return' => '100',
'ShortName' => 'encode_read_file_req'
},
- '223014' => {
+ '223234' => {
'Header' => 'file_io.h',
'Line' => '330',
'Param' => {
@@ -8810,7 +8810,7 @@
'Return' => '100',
'ShortName' => 'decode_read_file_req'
},
- '223150' => {
+ '223370' => {
'Header' => 'file_io.h',
'Line' => '274',
'Param' => {
@@ -8854,7 +8854,7 @@
'Return' => '100',
'ShortName' => 'decode_get_file_table_resp'
},
- '223324' => {
+ '223544' => {
'Header' => 'file_io.h',
'Line' => '258',
'Param' => {
@@ -8882,7 +8882,7 @@
'Return' => '100',
'ShortName' => 'encode_get_file_table_req'
},
- '223551' => {
+ '223771' => {
'Header' => 'file_io.h',
'Line' => '244',
'Param' => {
@@ -8922,7 +8922,7 @@
'Return' => '100',
'ShortName' => 'encode_get_file_table_resp'
},
- '223909' => {
+ '224129' => {
'Header' => 'file_io.h',
'Line' => '227',
'Param' => {
@@ -8956,7 +8956,7 @@
'Return' => '100',
'ShortName' => 'decode_get_file_table_req'
},
- '224044' => {
+ '224264' => {
'Header' => 'file_io.h',
'Line' => '183',
'Param' => {
@@ -8986,7 +8986,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_memory_resp'
},
- '224153' => {
+ '224373' => {
'Header' => 'file_io.h',
'Line' => '169',
'Param' => {
@@ -9026,7 +9026,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_memory_req'
},
- '224412' => {
+ '224632' => {
'Header' => 'file_io.h',
'Line' => '152',
'Param' => {
@@ -9054,7 +9054,7 @@
'Return' => '100',
'ShortName' => 'encode_rw_file_memory_resp'
},
- '224633' => {
+ '224853' => {
'Header' => 'file_io.h',
'Line' => '136',
'Param' => {
@@ -9093,7 +9093,7 @@
'Return' => '100',
'ShortName' => 'decode_rw_file_memory_req'
},
- '225682' => {
+ '225902' => {
'Header' => 'host.h',
'Line' => '101',
'Param' => {
@@ -9128,7 +9128,7 @@
'Return' => '100',
'ShortName' => 'encode_get_alert_status_resp'
},
- '225930' => {
+ '226150' => {
'Header' => 'host.h',
'Line' => '86',
'Param' => {
@@ -9153,7 +9153,7 @@
'Return' => '100',
'ShortName' => 'decode_get_alert_status_req'
},
- '226013' => {
+ '226233' => {
'Header' => 'host.h',
'Line' => '70',
'Param' => {
@@ -9187,7 +9187,7 @@
'Return' => '100',
'ShortName' => 'decode_get_alert_status_resp'
},
- '226152' => {
+ '226372' => {
'Header' => 'host.h',
'Line' => '52',
'Param' => {
@@ -9211,7 +9211,7 @@
'Return' => '100',
'ShortName' => 'encode_get_alert_status_req'
},
- '227220' => {
+ '227440' => {
'Header' => 'platform.h',
'Line' => '47',
'Param' => {
@@ -9248,7 +9248,7 @@
'Return' => '100',
'ShortName' => 'encode_bios_attribute_update_event_req'
},
- '229070' => {
+ '229290' => {
'Header' => 'file_io.h',
'Line' => '160',
'Param' => {
@@ -9258,7 +9258,7 @@
},
'1' => {
'name' => 'resp',
- 'type' => '230789'
+ 'type' => '231009'
},
'2' => {
'name' => 'resp_len',
@@ -9279,13 +9279,13 @@
'Return' => '100',
'ShortName' => 'encode_oem_meta_file_io_read_resp'
},
- '230804' => {
+ '231024' => {
'Header' => 'file_io.h',
'Line' => '147',
'Param' => {
'0' => {
'name' => 'resp',
- 'type' => '230789'
+ 'type' => '231009'
}
},
'Reg' => {
@@ -9294,7 +9294,7 @@
'Return' => '2634',
'ShortName' => 'pldm_oem_meta_file_io_read_resp_data'
},
- '230852' => {
+ '231072' => {
'Header' => 'file_io.h',
'Line' => '137',
'Param' => {
@@ -9308,13 +9308,13 @@
},
'2' => {
'name' => 'req',
- 'type' => '231908'
+ 'type' => '232128'
}
},
'Return' => '100',
'ShortName' => 'decode_oem_meta_file_io_read_req'
},
- '231913' => {
+ '232133' => {
'Header' => 'file_io.h',
'Line' => '126',
'Param' => {
@@ -9349,7 +9349,7 @@
'Return' => '100',
'ShortName' => 'decode_oem_meta_file_io_req'
},
- '232349' => {
+ '232569' => {
'Header' => 'file_io.h',
'Line' => '113',
'Param' => {
@@ -9363,7 +9363,7 @@
},
'2' => {
'name' => 'req',
- 'type' => '232344'
+ 'type' => '232564'
},
'3' => {
'name' => 'req_length',
@@ -9373,13 +9373,13 @@
'Return' => '100',
'ShortName' => 'decode_oem_meta_file_io_write_req'
},
- '233298' => {
+ '233518' => {
'Header' => 'file_io.h',
'Line' => '102',
'Param' => {
'0' => {
'name' => 'req',
- 'type' => '232344'
+ 'type' => '232564'
}
},
'Reg' => {
@@ -12587,31 +12587,31 @@
'Size' => '8',
'Type' => 'Const'
},
- '191550' => {
+ '191770' => {
'BaseType' => '90241',
'Name' => 'struct pldm_state_effecter_pdr*',
'Size' => '8',
'Type' => 'Pointer'
},
- '191555' => {
- 'BaseType' => '191550',
+ '191775' => {
+ 'BaseType' => '191770',
'Name' => 'struct pldm_state_effecter_pdr*const',
'Size' => '8',
'Type' => 'Const'
},
- '191560' => {
+ '191780' => {
'BaseType' => '92173',
'Name' => 'struct state_effecter_possible_states const*',
'Size' => '8',
'Type' => 'Pointer'
},
- '191565' => {
- 'BaseType' => '191560',
+ '191785' => {
+ 'BaseType' => '191780',
'Name' => 'struct state_effecter_possible_states const*const',
'Size' => '8',
'Type' => 'Const'
},
- '194503' => {
+ '194723' => {
'Line' => '19',
'Memb' => {
'0' => {
@@ -12631,13 +12631,13 @@
'Source' => 'instance-id.c',
'Type' => 'Struct'
},
- '194542' => {
+ '194762' => {
'Line' => '24',
'Memb' => {
'0' => {
'name' => 'state',
'offset' => '0',
- 'type' => '194584'
+ 'type' => '194804'
},
'1' => {
'name' => 'lock_db_fd',
@@ -12651,31 +12651,31 @@
'Source' => 'instance-id.c',
'Type' => 'Struct'
},
- '194584' => {
- 'BaseType' => '194503',
+ '194804' => {
+ 'BaseType' => '194723',
'Name' => 'struct pldm_tid_state[256]',
'Size' => '2048',
'Type' => 'Array'
},
- '195140' => {
- 'BaseType' => '194542',
+ '195360' => {
+ 'BaseType' => '194762',
'Name' => 'struct pldm_instance_db*',
'Size' => '8',
'Type' => 'Pointer'
},
- '195527' => {
+ '195747' => {
'BaseType' => '187',
'Name' => 'pldm_instance_id_t*',
'Size' => '8',
'Type' => 'Pointer'
},
- '195703' => {
- 'BaseType' => '195140',
+ '195923' => {
+ 'BaseType' => '195360',
'Name' => 'struct pldm_instance_db**',
'Size' => '8',
'Type' => 'Pointer'
},
- '196495' => {
+ '196715' => {
'BaseType' => '121',
'Header' => 'pldm.h',
'Line' => '13',
@@ -12683,7 +12683,7 @@
'Size' => '1',
'Type' => 'Typedef'
},
- '196610' => {
+ '196830' => {
'BaseType' => '284',
'Header' => 'pldm.h',
'Line' => '30',
@@ -12691,13 +12691,13 @@
'Size' => '4',
'Type' => 'Typedef'
},
- '196628' => {
+ '196848' => {
'Line' => '26',
'Memb' => {
'0' => {
'name' => 'transport',
'offset' => '0',
- 'type' => '196701'
+ 'type' => '196921'
},
'1' => {
'name' => 'socket',
@@ -12707,12 +12707,12 @@
'2' => {
'name' => 'tid_eid_map',
'offset' => '68',
- 'type' => '200397'
+ 'type' => '200617'
},
'3' => {
'name' => 'socket_send_buf',
'offset' => '768',
- 'type' => '199317'
+ 'type' => '199537'
}
},
'Name' => 'struct pldm_transport_mctp_demux',
@@ -12721,19 +12721,19 @@
'Source' => 'mctp-demux.c',
'Type' => 'Struct'
},
- '196654' => {
- 'BaseType' => '196628',
+ '196874' => {
+ 'BaseType' => '196848',
'Name' => 'struct pldm_transport_mctp_demux*',
'Size' => '8',
'Type' => 'Pointer'
},
- '196696' => {
- 'BaseType' => '196701',
+ '196916' => {
+ 'BaseType' => '196921',
'Name' => 'struct pldm_transport*',
'Size' => '8',
'Type' => 'Pointer'
},
- '196701' => {
+ '196921' => {
'Header' => 'transport.h',
'Line' => '18',
'Memb' => {
@@ -12750,17 +12750,17 @@
'2' => {
'name' => 'recv',
'offset' => '22',
- 'type' => '199628'
+ 'type' => '199848'
},
'3' => {
'name' => 'send',
'offset' => '36',
- 'type' => '199669'
+ 'type' => '199889'
},
'4' => {
'name' => 'init_pollfd',
'offset' => '50',
- 'type' => '199749'
+ 'type' => '199969'
}
},
'Name' => 'struct pldm_transport',
@@ -12768,19 +12768,19 @@
'Size' => '40',
'Type' => 'Struct'
},
- '196837' => {
+ '197057' => {
'BaseType' => '175',
'Name' => 'pldm_tid_t*',
'Size' => '8',
'Type' => 'Pointer'
},
- '196940' => {
- 'BaseType' => '196654',
+ '197160' => {
+ 'BaseType' => '196874',
'Name' => 'struct pldm_transport_mctp_demux**',
'Size' => '8',
'Type' => 'Pointer'
},
- '199037' => {
+ '199257' => {
'BaseType' => '46',
'Header' => 'int-ll64.h',
'Line' => '21',
@@ -12789,7 +12789,7 @@
'Size' => '1',
'Type' => 'Typedef'
},
- '199049' => {
+ '199269' => {
'BaseType' => '53',
'Header' => 'int-ll64.h',
'Line' => '24',
@@ -12798,7 +12798,7 @@
'Size' => '2',
'Type' => 'Typedef'
},
- '199317' => {
+ '199537' => {
'Header' => 'socket.h',
'Line' => '5',
'Memb' => {
@@ -12823,14 +12823,14 @@
'Size' => '12',
'Type' => 'Struct'
},
- '199628' => {
+ '199848' => {
'Name' => 'pldm_requester_rc_t(*)(struct pldm_transport*, pldm_tid_t*, void**, size_t*)',
'Param' => {
'0' => {
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
- 'type' => '196837'
+ 'type' => '197057'
},
'2' => {
'type' => '52328'
@@ -12839,15 +12839,15 @@
'type' => '13144'
}
},
- 'Return' => '196610',
+ 'Return' => '196830',
'Size' => '8',
'Type' => 'FuncPtr'
},
- '199669' => {
+ '199889' => {
'Name' => 'pldm_requester_rc_t(*)(struct pldm_transport*, pldm_tid_t, void const*, size_t)',
'Param' => {
'0' => {
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
'type' => '175'
@@ -12859,17 +12859,17 @@
'type' => '1140'
}
},
- 'Return' => '196610',
+ 'Return' => '196830',
'Size' => '8',
'Type' => 'FuncPtr'
},
- '199694' => {
- 'BaseType' => '199699',
+ '199914' => {
+ 'BaseType' => '199919',
'Name' => 'struct pollfd*',
'Size' => '8',
'Type' => 'Pointer'
},
- '199699' => {
+ '199919' => {
'Header' => 'poll.h',
'Line' => '36',
'Memb' => {
@@ -12894,21 +12894,21 @@
'Size' => '8',
'Type' => 'Struct'
},
- '199749' => {
+ '199969' => {
'Name' => 'int(*)(struct pldm_transport*, struct pollfd*)',
'Param' => {
'0' => {
- 'type' => '196696'
+ 'type' => '196916'
},
'1' => {
- 'type' => '199694'
+ 'type' => '199914'
}
},
'Return' => '100',
'Size' => '8',
'Type' => 'FuncPtr'
},
- '199754' => {
+ '199974' => {
'BaseType' => '53',
'Header' => 'socket.h',
'Line' => '10',
@@ -12917,14 +12917,14 @@
'Size' => '2',
'Type' => 'Typedef'
},
- '200131' => {
+ '200351' => {
'Header' => 'mctp.h',
'Line' => '18',
'Memb' => {
'0' => {
'name' => 's_addr',
'offset' => '0',
- 'type' => '196495'
+ 'type' => '196715'
}
},
'Name' => 'struct mctp_addr',
@@ -12932,19 +12932,19 @@
'Size' => '1',
'Type' => 'Struct'
},
- '200157' => {
+ '200377' => {
'Header' => 'mctp.h',
'Line' => '22',
'Memb' => {
'0' => {
'name' => 'smctp_family',
'offset' => '0',
- 'type' => '199754'
+ 'type' => '199974'
},
'1' => {
'name' => '__smctp_pad0',
'offset' => '2',
- 'type' => '199049'
+ 'type' => '199269'
},
'2' => {
'name' => 'smctp_network',
@@ -12954,22 +12954,22 @@
'3' => {
'name' => 'smctp_addr',
'offset' => '8',
- 'type' => '200131'
+ 'type' => '200351'
},
'4' => {
'name' => 'smctp_type',
'offset' => '9',
- 'type' => '199037'
+ 'type' => '199257'
},
'5' => {
'name' => 'smctp_tag',
'offset' => '16',
- 'type' => '199037'
+ 'type' => '199257'
},
'6' => {
'name' => '__smctp_pad1',
'offset' => '17',
- 'type' => '199037'
+ 'type' => '199257'
}
},
'Name' => 'struct sockaddr_mctp',
@@ -12977,19 +12977,19 @@
'Size' => '12',
'Type' => 'Struct'
},
- '200261' => {
- 'BaseType' => '200157',
+ '200481' => {
+ 'BaseType' => '200377',
'Name' => 'struct sockaddr_mctp const',
'Size' => '12',
'Type' => 'Const'
},
- '200304' => {
+ '200524' => {
'Line' => '35',
'Memb' => {
'0' => {
'name' => 'transport',
'offset' => '0',
- 'type' => '196701'
+ 'type' => '196921'
},
'1' => {
'name' => 'socket',
@@ -12999,12 +12999,12 @@
'2' => {
'name' => 'tid_eid_map',
'offset' => '68',
- 'type' => '200397'
+ 'type' => '200617'
},
'3' => {
'name' => 'socket_send_buf',
'offset' => '768',
- 'type' => '199317'
+ 'type' => '199537'
},
'4' => {
'name' => 'bound',
@@ -13023,31 +13023,31 @@
'Source' => 'af-mctp.c',
'Type' => 'Struct'
},
- '200397' => {
+ '200617' => {
'BaseType' => '175',
'Name' => 'pldm_tid_t[256]',
'Size' => '256',
'Type' => 'Array'
},
- '201198' => {
- 'BaseType' => '200304',
+ '201418' => {
+ 'BaseType' => '200524',
'Name' => 'struct pldm_transport_af_mctp*',
'Size' => '8',
'Type' => 'Pointer'
},
- '201203' => {
- 'BaseType' => '200261',
+ '201423' => {
+ 'BaseType' => '200481',
'Name' => 'struct sockaddr_mctp const*',
'Size' => '8',
'Type' => 'Pointer'
},
- '201516' => {
- 'BaseType' => '201198',
+ '201736' => {
+ 'BaseType' => '201418',
'Name' => 'struct pldm_transport_af_mctp**',
'Size' => '8',
'Type' => 'Pointer'
},
- '228011' => {
+ '228231' => {
'Header' => 'file_io.h',
'Line' => '32',
'Memb' => {
@@ -13071,7 +13071,7 @@
'Size' => '8',
'Type' => 'Struct'
},
- '228078' => {
+ '228298' => {
'Header' => 'file_io.h',
'Line' => '45',
'Memb' => {
@@ -13090,7 +13090,7 @@
'Size' => '4',
'Type' => 'Struct'
},
- '228117' => {
+ '228337' => {
'Header' => 'file_io.h',
'Line' => '55',
'Memb' => {
@@ -13109,21 +13109,21 @@
'Size' => '8',
'Type' => 'Struct'
},
- '228156' => {
+ '228376' => {
'Header' => 'file_io.h',
'Line' => '70',
'Memb' => {
'0' => {
'name' => 'data',
'offset' => '0',
- 'type' => '228078'
+ 'type' => '228298'
}
},
'Name' => 'anon-union-file_io.h-70',
'Size' => '4',
'Type' => 'Union'
},
- '228174' => {
+ '228394' => {
'Header' => 'file_io.h',
'Line' => '65',
'Memb' => {
@@ -13150,33 +13150,33 @@
'4' => {
'name' => 'info',
'offset' => '18',
- 'type' => '228156'
+ 'type' => '228376'
}
},
'Name' => 'struct pldm_oem_meta_file_io_read_req',
'Size' => '16',
'Type' => 'Struct'
},
- '228252' => {
+ '228472' => {
'Header' => 'file_io.h',
'Line' => '86',
'Memb' => {
'0' => {
'name' => 'attr',
'offset' => '0',
- 'type' => '228117'
+ 'type' => '228337'
},
'1' => {
'name' => 'data',
'offset' => '0',
- 'type' => '228078'
+ 'type' => '228298'
}
},
'Name' => 'anon-union-file_io.h-86',
'Size' => '8',
'Type' => 'Union'
},
- '228280' => {
+ '228500' => {
'Header' => 'file_io.h',
'Line' => '80',
'Memb' => {
@@ -13208,7 +13208,7 @@
'5' => {
'name' => 'info',
'offset' => '18',
- 'type' => '228252'
+ 'type' => '228472'
},
'6' => {
'name' => 'data',
@@ -13220,20 +13220,20 @@
'Size' => '24',
'Type' => 'Struct'
},
- '230789' => {
- 'BaseType' => '228280',
+ '231009' => {
+ 'BaseType' => '228500',
'Name' => 'struct pldm_oem_meta_file_io_read_resp*',
'Size' => '8',
'Type' => 'Pointer'
},
- '231908' => {
- 'BaseType' => '228174',
+ '232128' => {
+ 'BaseType' => '228394',
'Name' => 'struct pldm_oem_meta_file_io_read_req*',
'Size' => '8',
'Type' => 'Pointer'
},
- '232344' => {
- 'BaseType' => '228011',
+ '232564' => {
+ 'BaseType' => '228231',
'Name' => 'struct pldm_oem_meta_file_io_write_req*',
'Size' => '8',
'Type' => 'Pointer'
diff --git a/src/dsp/platform.c b/src/dsp/platform.c
index df7ea4a..b72fb5f 100644
--- a/src/dsp/platform.c
+++ b/src/dsp/platform.c
@@ -28,8 +28,8 @@
return PLDM_ERROR;
}
- if (SIZE_MAX - (sizeof(*effecter) - sizeof(effecter->possible_states) <
- possible_states_size)) {
+ if (SIZE_MAX - (sizeof(*effecter) - sizeof(effecter->possible_states)) <
+ possible_states_size) {
return PLDM_ERROR;
}
diff --git a/tests/dsp/platform.cpp b/tests/dsp/platform.cpp
index 9c44130..6f1c181 100644
--- a/tests/dsp/platform.cpp
+++ b/tests/dsp/platform.cpp
@@ -16,6 +16,68 @@
constexpr auto hdrSize = sizeof(pldm_msg_hdr);
+TEST(StateEffecterPdr, testIncorrectInvocations)
+{
+ struct state_effecter_possible_states possible_states
+ {
+ };
+ struct pldm_state_effecter_pdr effecter
+ {
+ };
+ size_t actual_size;
+ int rc;
+
+ /* effecter can't be NULL */
+ rc = encode_state_effecter_pdr(NULL, 0, &possible_states, 1, &actual_size);
+ EXPECT_EQ(rc, PLDM_ERROR);
+
+ /* possible states size can't be NULL */
+ rc = encode_state_effecter_pdr(&effecter, sizeof(effecter), NULL, 0,
+ &actual_size);
+ EXPECT_EQ(rc, PLDM_ERROR);
+
+ /* possible states size can't be too large */
+ rc = encode_state_effecter_pdr(&effecter, sizeof(effecter),
+ &possible_states, SIZE_MAX, &actual_size);
+ EXPECT_EQ(rc, PLDM_ERROR);
+
+ /* actual size can't be NULL */
+ rc = encode_state_effecter_pdr(&effecter, sizeof(effecter),
+ &possible_states, 0, NULL);
+ EXPECT_EQ(rc, PLDM_ERROR);
+
+ /* allocation size can't be less than effecter size with possible states */
+ rc = encode_state_effecter_pdr(&effecter, 0, &possible_states, 1,
+ &actual_size);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
+
+ /* disallow mismatches between recorded possible state size and provided
+ * possible state size */
+ effecter.composite_effecter_count = 1;
+ rc = encode_state_effecter_pdr(&effecter, sizeof(effecter),
+ &possible_states, 1, &actual_size);
+ EXPECT_EQ(rc, PLDM_ERROR);
+ EXPECT_EQ(actual_size, 0);
+}
+
+TEST(StateEffecterPdr, testReasonableInvocations)
+{
+ struct state_effecter_possible_states possible_states
+ {
+ };
+ struct pldm_state_effecter_pdr effecter
+ {
+ };
+ size_t actual_size;
+ int rc;
+
+ /* Accept 0 possible states */
+ rc = encode_state_effecter_pdr(&effecter, sizeof(effecter),
+ &possible_states, 0, &actual_size);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(actual_size, sizeof(effecter) - sizeof(effecter.possible_states));
+}
+
TEST(SetStateEffecterStates, testEncodeResponse)
{
std::array<uint8_t,