5
5
* reserved.
6
6
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
7
7
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
8
- * Copyright (c) 2017-2018 Research Organization for Information Science
8
+ * Copyright (c) 2017-2019 Research Organization for Information Science
9
9
* and Technology (RIST). All rights reserved.
10
10
* $COPYRIGHT$
11
11
*
@@ -170,8 +170,18 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
170
170
ddt_endloop_desc_t * end_loop = (ddt_endloop_desc_t * )(pElem + pElem -> loop .items );
171
171
172
172
if ( pElem -> loop .common .flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
173
- source_base += end_loop -> first_elem_disp ;
174
- for (size_t i = count_desc ; (i > 0 ) && (index < * iov_count ); i -- , index ++ ) {
173
+ ptrdiff_t offset = end_loop -> first_elem_disp ;
174
+ source_base += offset ;
175
+ for (size_t i = count_desc ; i > 0 ; i -- , index ++ ) {
176
+ if (index >= * iov_count ) {
177
+ dt_elem_desc_t * nElem = pElem + 1 ;
178
+ while (nElem -> elem .common .type == OPAL_DATATYPE_LOOP ) {
179
+ nElem ++ ;
180
+ }
181
+ assert (OPAL_DATATYPE_END_LOOP != nElem -> elem .common .type );
182
+ offset = nElem -> elem .disp ;
183
+ break ;
184
+ }
175
185
OPAL_DATATYPE_SAFEGUARD_POINTER ( source_base , end_loop -> size , pConvertor -> pBaseBuf ,
176
186
pConvertor -> pDesc , pConvertor -> count );
177
187
iov [index ].iov_base = (IOVBASE_TYPE * ) source_base ;
@@ -180,7 +190,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
180
190
raw_data += end_loop -> size ;
181
191
count_desc -- ;
182
192
}
183
- source_base -= end_loop -> first_elem_disp ;
193
+ source_base -= offset ;
184
194
if ( 0 == count_desc ) { /* completed */
185
195
pos_desc += pElem -> loop .items + 1 ;
186
196
goto update_loop_description ;
0 commit comments