diff mbox series

[010/117] ufs: Add a compile-time structure size check

Message ID 20210420000845.25873-11-bvanassche@acm.org
State New
Headers show
Series Make better use of static type checking | expand

Commit Message

Bart Van Assche April 20, 2021, 12:06 a.m. UTC
Before modifying the definition of struct ufs_bsg_reply, add a compile-time
structure size check.

Cc: Can Guo <cang@codeaurora.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Can Guo May 6, 2021, 11:56 p.m. UTC | #1
On 2021-04-20 08:06, Bart Van Assche wrote:
> Before modifying the definition of struct ufs_bsg_reply, add a 

> compile-time

> structure size check.

> 

> Cc: Can Guo <cang@codeaurora.org>

> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

> ---

>  drivers/scsi/ufs/ufshcd.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

> index 0625da7a42ee..fa596cf66c23 100644

> --- a/drivers/scsi/ufs/ufshcd.c

> +++ b/drivers/scsi/ufs/ufshcd.c

> @@ -9455,6 +9455,8 @@ EXPORT_SYMBOL_GPL(ufshcd_init);

> 

>  static int __init ufshcd_core_init(void)

>  {

> +	BUILD_BUG_ON(offsetof(struct ufs_bsg_reply, upiu_rsp) != 8);

> +

>  	ufs_debugfs_init();

>  	return 0;

>  }


Reviewed-by: Can Guo <cang@codeaurora.org>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 0625da7a42ee..fa596cf66c23 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9455,6 +9455,8 @@  EXPORT_SYMBOL_GPL(ufshcd_init);
 
 static int __init ufshcd_core_init(void)
 {
+	BUILD_BUG_ON(offsetof(struct ufs_bsg_reply, upiu_rsp) != 8);
+
 	ufs_debugfs_init();
 	return 0;
 }