Re: [PATCH 009/117] iscsi: Add a compile-time structure size check

Lee Duncan
2021-05-06T16:52:54Z

On 4/19/21 5:06 PM, Bart Van Assche wrote:
> Before modifying the struct iscsi_bsg_reply definition, add a compile-time
> structure size check.
>
> Cc: Lee Duncan <lduncan@suse.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/scsi_transport_iscsi.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index bebfb355abdf..4f821118ea23 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -4729,6 +4729,9 @@ static __init int iscsi_transport_init(void)
> .groups = 1,
> .input = iscsi_if_rx,
> };
> +
> + BUILD_BUG_ON(offsetof(struct iscsi_bsg_reply, reply_data) != 8);
> +
> printk(KERN_INFO "Loading iSCSI transport class v%s.\n",
> ISCSI_TRANSPORT_VERSION);
>
>

Reviewed-by: Lee Duncan <lduncan@suse.com>