Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/usb



> Module Name:    src
> Committed By:   mlelstv
> Date:           Mon Apr 10 15:26:57 UTC 2023
> 
> Modified Files:
>         src/sys/dev/usb: uvideo.c uvideoreg.h
> 
> Log Message:
> Better descriptor parsing.

How is it better?  What problems does it fix?

> Add sanity check if no default format is found.
> 
> @@ -442,12 +442,8 @@ static void print_vs_format_dv_descripto
>         const uvideo_vs_format_dv_descriptor_t *);
>  #endif /* !UVIDEO_DEBUG */
>  
> -#define GET(type, descp, field)                                                      \
> -       (KASSERT((descp)->bLength >= sizeof(type)),                           \
> -           ((const type *)(descp))->field)
> -#define GETP(type, descp, field)                                             \
> -       (KASSERT((descp)->bLength >= sizeof(type)),                           \
> -           &(((const type *)(descp))->field))
> +#define GET(type, descp, field) (((const type *)(descp))->field)
> +#define GETP(type, descp, field) (&(((const type *)(descp))->field))
> [...]
> @@ -1398,8 +1398,6 @@ uvideo_stream_init_frame_based_format(st
>                 return USBD_INVAL;
>         }
>  
> -       KASSERT(subtypelen >= sizeof(*uvdesc));

Please restore these assertions, and adjust them if needed to make
them work.

> +       uvideo_frame_interval_t uFrameInterval;
>  } UPACKED uvideo_vs_frame_uncompressed_descriptor_t;
> -CTASSERT(sizeof(uvideo_vs_frame_uncompressed_descriptor_t) == 26);

Please restore compile-time assertions of these structure sizes so
that it is easy to verify they match the spec.  Please also add a
reference to the section/page/table number in the spec in a comment so
it's easy to look up.


Home | Main Index | Thread Index | Old Index