]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:55 +0000 (12:50 +0100)
commit668ef6c54ca7b3c2c332aa86cf36db6500aee235
treeac8396db2103e4e446b2d345da15a9b08f20f395
parent4b49d939b5a79117f939b77cc67efae2694d9799
scsi: core: Don't memset() the entire scsi_cmnd in scsi_init_command()

[ Upstream commit 71bada345b33b9297e7cc9415db6328c99b554f9 ]

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>
Stable-dep-of: dce5c4afd035 ("scsi: core: Clear driver private data when retrying request")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/scsi_lib.c