scsi: ufs: core: Add a compile-time structure size check

Before modifying struct ufshcd_sg_entry, add a compile-time structure size
check.

Link: https://lore.kernel.org/r/20211020214024.2007615-10-bvanassche@acm.org
Acked-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Bart Van Assche 2021-10-20 14:40:23 -07:00 committed by Martin K. Petersen
parent 3ad317a1f9
commit 9a868c8ad3

View File

@ -9791,6 +9791,11 @@ static int __init ufshcd_core_init(void)
{
int ret;
/* Verify that there are no gaps in struct utp_transfer_cmd_desc. */
static_assert(sizeof(struct utp_transfer_cmd_desc) ==
2 * ALIGNED_UPIU_SIZE +
SG_ALL * sizeof(struct ufshcd_sg_entry));
ufs_debugfs_init();
ret = scsi_register_driver(&ufs_dev_wlun_template.gendrv);