Skip to content

Commit cd6856d

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: sd: Remove the stream_status member from scsi_stream_status_header
Having a variable length array at the end of scsi_stream_status_header only causes problems. Remove it and switch sd_is_perm_stream(), which is the only place that currently uses it, to use the scsi_stream_status directly following it in the local buf structure. Besides being a much better data structure design, this also avoids a -Wflex-array-member-not-at-end warning. Reported-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: John Garry <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7334969 commit cd6856d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

drivers/scsi/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,7 @@ static bool sd_is_perm_stream(struct scsi_disk *sdkp, unsigned int stream_id)
32153215
return false;
32163216
if (get_unaligned_be32(&buf.h.len) < sizeof(struct scsi_stream_status))
32173217
return false;
3218-
return buf.h.stream_status[0].perm;
3218+
return buf.s.perm;
32193219
}
32203220

32213221
static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer)

include/scsi/scsi_proto.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,9 @@ static_assert(sizeof(struct scsi_stream_status) == 8);
346346

347347
/* GET STREAM STATUS parameter data */
348348
struct scsi_stream_status_header {
349-
__be32 len; /* length in bytes of stream_status[] array. */
349+
__be32 len; /* length in bytes of following payload */
350350
u16 reserved;
351351
__be16 number_of_open_streams;
352-
DECLARE_FLEX_ARRAY(struct scsi_stream_status, stream_status);
353352
};
354353

355354
static_assert(sizeof(struct scsi_stream_status_header) == 8);

0 commit comments

Comments
 (0)