Skip to content

Commit

Permalink
usb: fix undefined behavior caused by zero-length array
Browse files Browse the repository at this point in the history
The use of zero-length array causes undefined behavior.
Replace zero-length array with flexible-array member.

Bug: 174330770
Test: build pass and boot to home
Change-Id: I080ed1555d5b60075f6a86aa0ac15427529f7a1b
Signed-off-by: Jimmy Hu <[email protected]>
Signed-off-by: Puma Hsu <[email protected]>
  • Loading branch information
Jimmy Hu authored and Arjun-Ingole committed Apr 25, 2022
1 parent 743e8de commit 2af5957
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/linux/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1580,9 +1580,8 @@ struct urb {
int error_count; /* (return) number of ISO errors */
void *context; /* (in) context for completion */
usb_complete_t complete; /* (in) completion routine */
struct usb_iso_packet_descriptor iso_frame_desc[0];
/* (in) ISO ONLY */
void *priv_data; /* (in) additional private data */
struct usb_iso_packet_descriptor iso_frame_desc[]; /* (in) ISO ONLY */
};

/* ----------------------------------------------------------------------- */
Expand Down

0 comments on commit 2af5957

Please sign in to comment.