scsi: core: Don't memset() the entire scsi_cmnd in scsi_init_command()
authorChristoph Hellwig <hch@lst.de>
Thu, 24 Feb 2022 17:55:46 +0000 (18:55 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 28 Feb 2022 03:27:59 +0000 (22:27 -0500)
commit5c0f9d6408651fba2bbc7546e5574dac7a244aad
tree0f49bae35d7279e05d82d0601eda2ed8a8cdd549
parented709ce8aea370ef0da2912ddbdaecd13b395d05
scsi: core: Don't memset() the entire scsi_cmnd in scsi_init_command()

Replace the big fat memset that requires saving and restoring various
fields with just initializing those fields that need initialization.

All the clearing to 0 is moved to scsi_prepare_cmd() as scsi_ioctl_reset()
alreadly uses kzalloc() to allocate a pre-zeroed command.

This is still conservative and can probably be optimized further.

Link: https://lore.kernel.org/r/20220224175552.988286-3-hch@lst.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c