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 <nathan@kernel.org> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent 9f4dc05 commit 55a15b3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)