Skip to content

Commit

Permalink
scsi: ufs: core: Add a compile-time structure size check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bart Van Assche authored and Martin K. Petersen committed Oct 27, 2021
1 parent 3ad317a commit 9a868c8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9a868c8

Please sign in to comment.