mbox series

[v2,0/2] USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by

Message ID 20240619-garmin_gps_counted_by-v2-0-f82f10ebbf28@gmail.com (mailing list archive)
Headers show
Series USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by | expand

Message

Javier Carrasco June 19, 2024, 7:42 p.m. UTC
The size is assigned before the first reference to the flexible array
(see pkt_add()), which allows for a straightforward annotation without
further modifications.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Changes in v2:
- Use struct_size to calculate the size of pkt.
- Link to v1: https://lore.kernel.org/r/20240619-garmin_gps_counted_by-v1-1-d8d816f085d9@gmail.com

---
Javier Carrasco (2):
      USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by
      USB: serial: garmin_gps: use struct_size to allocate pkt

 drivers/usb/serial/garmin_gps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
base-commit: 0c52056d9f77508cb6d4d68d3fc91c6c08ec71af
change-id: 20240619-garmin_gps_counted_by-376545960353

Best regards,

Comments

Johan Hovold July 5, 2024, 12:04 p.m. UTC | #1
On Wed, Jun 19, 2024 at 09:42:43PM +0200, Javier Carrasco wrote:
> The size is assigned before the first reference to the flexible array
> (see pkt_add()), which allows for a straightforward annotation without
> further modifications.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
> Changes in v2:
> - Use struct_size to calculate the size of pkt.
> - Link to v1: https://lore.kernel.org/r/20240619-garmin_gps_counted_by-v1-1-d8d816f085d9@gmail.com
> 
> ---
> Javier Carrasco (2):
>       USB: serial: garmin_gps: annotate struct garmin_packet with __counted_by
>       USB: serial: garmin_gps: use struct_size to allocate pkt

Now applied (after adding parentheses to struct_size() in the summary).

Johan