Skip to content
Commit a4ff8e7a authored by Li Ming's avatar Li Ming Committed by Bjorn Helgaas
Browse files

PCI/DOE: Fix maximum data object length miscalculation

Per PCIe r6.0, sec 6.30.1, a data object Length of 0x0 indicates 2^18
DWORDs (256K DW or 1MB) being transferred.  Adjust the value of data object
length for this case on both sending side and receiving side.

Don't bother checking whether Length is greater than SZ_1M because all
values of the 18-bit Length field are valid, and it is impossible to
represent anything larger than SZ_1M:

  0x00000    256K DW (1M bytes)
  0x00001       1 DW (4 bytes)
  ...
  0x3ffff  256K-1 DW (1M - 4 bytes)

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20221116015637.3299664-1-ming4.li@intel.com


Fixes: 9d24322e ("PCI/DOE: Add DOE mailbox support functions")
Signed-off-by: default avatarLi Ming <ming4.li@intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarLukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org	# v6.0+
parent 9abf2313
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment