Merge tag 'firewire-updates-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394

Pull firewire update from Takashi Sakamoto:
"A single commit to use the common helper function for on-stack
trailing array to enqueue any isochronous packet by the requests
from userspace applications"

* tag 'firewire-updates-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: core: avoid -Wflex-array-member-not-at-end warning

+19 -23
+19 -23
drivers/firewire/core-cdev.c
··· 1137 unsigned long payload, buffer_end, transmit_header_bytes = 0; 1138 u32 control; 1139 int count; 1140 - struct { 1141 - struct fw_iso_packet packet; 1142 - u8 header[256]; 1143 - } u; 1144 1145 if (ctx == NULL || a->handle != 0) 1146 return -EINVAL; ··· 1169 while (p < end) { 1170 if (get_user(control, &p->control)) 1171 return -EFAULT; 1172 - u.packet.payload_length = GET_PAYLOAD_LENGTH(control); 1173 - u.packet.interrupt = GET_INTERRUPT(control); 1174 - u.packet.skip = GET_SKIP(control); 1175 - u.packet.tag = GET_TAG(control); 1176 - u.packet.sy = GET_SY(control); 1177 - u.packet.header_length = GET_HEADER_LENGTH(control); 1178 1179 switch (ctx->type) { 1180 case FW_ISO_CONTEXT_TRANSMIT: 1181 - if (u.packet.header_length & 3) 1182 return -EINVAL; 1183 - transmit_header_bytes = u.packet.header_length; 1184 break; 1185 1186 case FW_ISO_CONTEXT_RECEIVE: 1187 - if (u.packet.header_length == 0 || 1188 - u.packet.header_length % ctx->header_size != 0) 1189 return -EINVAL; 1190 break; 1191 1192 case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: 1193 - if (u.packet.payload_length == 0 || 1194 - u.packet.payload_length & 3) 1195 return -EINVAL; 1196 break; 1197 } ··· 1201 if (next > end) 1202 return -EINVAL; 1203 if (copy_from_user 1204 - (u.packet.header, p->header, transmit_header_bytes)) 1205 return -EFAULT; 1206 - if (u.packet.skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT && 1207 - u.packet.header_length + u.packet.payload_length > 0) 1208 return -EINVAL; 1209 - if (payload + u.packet.payload_length > buffer_end) 1210 return -EINVAL; 1211 1212 - if (fw_iso_context_queue(ctx, &u.packet, 1213 - &client->buffer, payload)) 1214 break; 1215 1216 p = next; 1217 - payload += u.packet.payload_length; 1218 count++; 1219 } 1220 fw_iso_context_queue_flush(ctx);
··· 1137 unsigned long payload, buffer_end, transmit_header_bytes = 0; 1138 u32 control; 1139 int count; 1140 + DEFINE_RAW_FLEX(struct fw_iso_packet, u, header, 64); 1141 1142 if (ctx == NULL || a->handle != 0) 1143 return -EINVAL; ··· 1172 while (p < end) { 1173 if (get_user(control, &p->control)) 1174 return -EFAULT; 1175 + u->payload_length = GET_PAYLOAD_LENGTH(control); 1176 + u->interrupt = GET_INTERRUPT(control); 1177 + u->skip = GET_SKIP(control); 1178 + u->tag = GET_TAG(control); 1179 + u->sy = GET_SY(control); 1180 + u->header_length = GET_HEADER_LENGTH(control); 1181 1182 switch (ctx->type) { 1183 case FW_ISO_CONTEXT_TRANSMIT: 1184 + if (u->header_length & 3) 1185 return -EINVAL; 1186 + transmit_header_bytes = u->header_length; 1187 break; 1188 1189 case FW_ISO_CONTEXT_RECEIVE: 1190 + if (u->header_length == 0 || 1191 + u->header_length % ctx->header_size != 0) 1192 return -EINVAL; 1193 break; 1194 1195 case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: 1196 + if (u->payload_length == 0 || 1197 + u->payload_length & 3) 1198 return -EINVAL; 1199 break; 1200 } ··· 1204 if (next > end) 1205 return -EINVAL; 1206 if (copy_from_user 1207 + (u->header, p->header, transmit_header_bytes)) 1208 return -EFAULT; 1209 + if (u->skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT && 1210 + u->header_length + u->payload_length > 0) 1211 return -EINVAL; 1212 + if (payload + u->payload_length > buffer_end) 1213 return -EINVAL; 1214 1215 + if (fw_iso_context_queue(ctx, u, &client->buffer, payload)) 1216 break; 1217 1218 p = next; 1219 + payload += u->payload_length; 1220 count++; 1221 } 1222 fw_iso_context_queue_flush(ctx);