Skip to content

Commit a2cc6ff

Browse files
committed
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
2 parents 5014beb + ca2c736 commit a2cc6ff

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

drivers/firewire/core-cdev.c

+19-23
Original file line numberDiff line numberDiff line change
@@ -1137,10 +1137,7 @@ static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg)
11371137
unsigned long payload, buffer_end, transmit_header_bytes = 0;
11381138
u32 control;
11391139
int count;
1140-
struct {
1141-
struct fw_iso_packet packet;
1142-
u8 header[256];
1143-
} u;
1140+
DEFINE_RAW_FLEX(struct fw_iso_packet, u, header, 64);
11441141

11451142
if (ctx == NULL || a->handle != 0)
11461143
return -EINVAL;
@@ -1172,29 +1169,29 @@ static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg)
11721169
while (p < end) {
11731170
if (get_user(control, &p->control))
11741171
return -EFAULT;
1175-
u.packet.payload_length = GET_PAYLOAD_LENGTH(control);
1176-
u.packet.interrupt = GET_INTERRUPT(control);
1177-
u.packet.skip = GET_SKIP(control);
1178-
u.packet.tag = GET_TAG(control);
1179-
u.packet.sy = GET_SY(control);
1180-
u.packet.header_length = GET_HEADER_LENGTH(control);
1172+
u->payload_length = GET_PAYLOAD_LENGTH(control);
1173+
u->interrupt = GET_INTERRUPT(control);
1174+
u->skip = GET_SKIP(control);
1175+
u->tag = GET_TAG(control);
1176+
u->sy = GET_SY(control);
1177+
u->header_length = GET_HEADER_LENGTH(control);
11811178

11821179
switch (ctx->type) {
11831180
case FW_ISO_CONTEXT_TRANSMIT:
1184-
if (u.packet.header_length & 3)
1181+
if (u->header_length & 3)
11851182
return -EINVAL;
1186-
transmit_header_bytes = u.packet.header_length;
1183+
transmit_header_bytes = u->header_length;
11871184
break;
11881185

11891186
case FW_ISO_CONTEXT_RECEIVE:
1190-
if (u.packet.header_length == 0 ||
1191-
u.packet.header_length % ctx->header_size != 0)
1187+
if (u->header_length == 0 ||
1188+
u->header_length % ctx->header_size != 0)
11921189
return -EINVAL;
11931190
break;
11941191

11951192
case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
1196-
if (u.packet.payload_length == 0 ||
1197-
u.packet.payload_length & 3)
1193+
if (u->payload_length == 0 ||
1194+
u->payload_length & 3)
11981195
return -EINVAL;
11991196
break;
12001197
}
@@ -1204,20 +1201,19 @@ static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg)
12041201
if (next > end)
12051202
return -EINVAL;
12061203
if (copy_from_user
1207-
(u.packet.header, p->header, transmit_header_bytes))
1204+
(u->header, p->header, transmit_header_bytes))
12081205
return -EFAULT;
1209-
if (u.packet.skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT &&
1210-
u.packet.header_length + u.packet.payload_length > 0)
1206+
if (u->skip && ctx->type == FW_ISO_CONTEXT_TRANSMIT &&
1207+
u->header_length + u->payload_length > 0)
12111208
return -EINVAL;
1212-
if (payload + u.packet.payload_length > buffer_end)
1209+
if (payload + u->payload_length > buffer_end)
12131210
return -EINVAL;
12141211

1215-
if (fw_iso_context_queue(ctx, &u.packet,
1216-
&client->buffer, payload))
1212+
if (fw_iso_context_queue(ctx, u, &client->buffer, payload))
12171213
break;
12181214

12191215
p = next;
1220-
payload += u.packet.payload_length;
1216+
payload += u->payload_length;
12211217
count++;
12221218
}
12231219
fw_iso_context_queue_flush(ctx);

0 commit comments

Comments
 (0)