Skip to content

Commit 55a15b3

Browse files
javiercarrascocruzjhovold
authored andcommitted
USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by
Use the __counted_by compiler attribute for the data[] flexible array member to improve the results of array bound sanitizers. Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Javier Carrasco <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 9f4dc05 commit 55a15b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/serial/garmin_gps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct garmin_packet {
104104
int seq;
105105
/* the real size of the data array, always > 0 */
106106
int size;
107-
__u8 data[];
107+
__u8 data[] __counted_by(size);
108108
};
109109

110110
/* structure used to keep the current state of the driver */

0 commit comments

Comments
 (0)