]> git.baikalelectronics.ru Git - kernel.git/commit
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>
Wed, 2 Mar 2022 03:21:49 +0000 (22:21 -0500)
commit378860283299e91240e316ecfd2e80a18ca411b1
tree6865d4b16f1081f9f265d8186677ab4a2a3dea8a
parent1f626f0264b99a432c9bdc3b4ca5edced51a1598
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