There have been cases where seemingly innocuous patches have broken the uAPI by changing the memory layout of the parameter struct. Generally such changes also introduce a change in the size of the entire struct. This patch adds a sanity check to avoid such cases happening in the future. Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> --- drivers/staging/media/ipu3/ipu3-css.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/media/ipu3/ipu3-css.c b/drivers/staging/media/ipu3/ipu3-css.c index 4f04fe838b0c0..3c700ae9c94e9 100644 --- a/drivers/staging/media/ipu3/ipu3-css.c +++ b/drivers/staging/media/ipu3/ipu3-css.c @@ -1911,6 +1911,13 @@ int imgu_css_meta_fmt_set(struct v4l2_meta_format *fmt) switch (fmt->dataformat) { case V4L2_META_FMT_IPU3_PARAMS: fmt->buffersize = sizeof(struct ipu3_uapi_params); + + /* + * Sanity check for the parameter struct size. This must + * not change! + */ + BUILD_BUG_ON(sizeof(struct ipu3_uapi_params) != 39328); + break; case V4L2_META_FMT_IPU3_STAT_3A: fmt->buffersize = sizeof(struct ipu3_uapi_stats_3a); -- 2.20.1