From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: rajmohan.mani@intel.com, bingbu.cao@intel.com, tfiga@chromium.org
Subject: [PATCH 3/3] staging: ipu3-imgu: Add a sanity check for the parameter struct size
Date: Thu, 16 Apr 2020 12:18:50 +0300 [thread overview]
Message-ID: <20200416091850.31177-4-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20200416091850.31177-1-sakari.ailus@linux.intel.com>
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@linux.intel.com>
---
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
next prev parent reply other threads:[~2020-04-16 9:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 9:18 [PATCH 0/3] IPU3 ImgU driver parameter struct fixes Sakari Ailus
2020-04-16 9:18 ` [PATCH 1/3] Revert "staging: imgu: Address a compiler warning on alignment" Sakari Ailus
2020-04-27 15:39 ` [PATCH v1.1 " Sakari Ailus
2020-04-16 9:18 ` [PATCH 2/3] staging: ipu3-imgu: Move alignment attribute to field Sakari Ailus
2020-04-16 9:18 ` Sakari Ailus [this message]
2020-04-26 2:42 ` [PATCH 0/3] IPU3 ImgU driver parameter struct fixes Bingbu Cao
2020-04-27 15:43 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200416091850.31177-4-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=bingbu.cao@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=rajmohan.mani@intel.com \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.