55 * reserved.
66 * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
77 * 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
99 * and Technology (RIST). All rights reserved.
1010 * $COPYRIGHT$
1111 *
@@ -170,8 +170,18 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
170170 ddt_endloop_desc_t * end_loop = (ddt_endloop_desc_t * )(pElem + pElem -> loop .items );
171171
172172 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+ }
175185 OPAL_DATATYPE_SAFEGUARD_POINTER ( source_base , end_loop -> size , pConvertor -> pBaseBuf ,
176186 pConvertor -> pDesc , pConvertor -> count );
177187 iov [index ].iov_base = (IOVBASE_TYPE * ) source_base ;
@@ -180,7 +190,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
180190 raw_data += end_loop -> size ;
181191 count_desc -- ;
182192 }
183- source_base -= end_loop -> first_elem_disp ;
193+ source_base -= offset ;
184194 if ( 0 == count_desc ) { /* completed */
185195 pos_desc += pElem -> loop .items + 1 ;
186196 goto update_loop_description ;
0 commit comments