Re: [PATCH 2/3] scsi: megaraid_sas: check user-provided offsets

James Bottomley
2021-01-03T17:02:03Z

On Sun, 2021-01-03 at 17:26 +0100, Arnd Bergmann wrote:
[...]
> @@ -8209,7 +8208,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
> if (instance->consistent_mask_64bit)
> put_unaligned_le64(sense_handle, sense_ptr);
> else
> - put_unaligned_le32(sense_handle, sense_ptr);
> + put_unaligned_le64(sense_handle, sense_ptr);
> }

This hunk can't be right. It effectively means removing the if.
However, the if is needed because sense_handle is a dma_addr_t which
can be either 32 or 64 bit. What about changing the if to

if (sizeof(dma_addr_t) == 8)

instead?

James