mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-07 21:24:00 +08:00
thunderbolt: Fixes for v5.13-rc4
This includes two fixes from Mathias to handle NVM read side properly in certain situations. Both have been in linux-next with no reported issues. -----BEGIN PGP SIGNATURE----- iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmCrpYkgHG1pa2Eud2Vz dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKD8xBAAlbr/8sb25I5U VJtICCm+LFI+mksYQ6ps8h4OJIGv8J29f+OMx8mvmoPgtoO76gzPsoT6J6BG9q4a BiKnMJaP6e0DUSAE/0eeRyQh5z4rMl4qjYXREfrZU2hcbpoRhLHMFf6zF0VhvYfA Nl85LeMwKzY5TdlWc41CpFfcn4iYEwZNo+Rzi0cKdRCqTdBUIL5DG7PMZ8KMQ+3k Cd8REEe1uTOaZNRTWDSNduqXLqN9JtStl2GPPvdv0gInu+yIMtAMAjo/5ElJBkqb pJnaYvZSvvP5kq3UB5F3iTZXCwaD+fibIM2lmaFmAl9o8SadI6AwT6FUcTY/nz+3 mj+VBolM4Gp1LsEWfPN0xscNsbM7VMeKZ5m3282IQyRofa5Rs4a5sBUKIK+QsfQ9 80G+GFCqdt+pCIBle2qmK+nDsFNHbKRmMFM5XGA9kExA4Tc3J8c8kfoWni5VGJqF 7D//i2aNoGlkoXBSgCugniZZQZ8LCF0j3swlPTMxFNcQn6DAQLCTVLyrVzFGz6Tu 2KW6mcLgqZyuepvVXmvItL+8Fv+LvmKLxJmwcnls4xCYiB3/cHVmWuoRsHcvAKtD NAm0GlDWc2YVKZwnMizLSuoJyo/9q6Z7xnPqpn2AeyO9Sw8xoTlUMW/s+7+pHa7d YJb9wJmRAPxnVWMMyIpCuSkXmdmdy/g= =meMl -----END PGP SIGNATURE----- Merge tag 'thunderbolt-for-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus Mika writes: thunderbolt: Fixes for v5.13-rc4 This includes two fixes from Mathias to handle NVM read side properly in certain situations. Both have been in linux-next with no reported issues. * tag 'thunderbolt-for-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: usb4: Fix NVM read buffer bounds and offset issue thunderbolt: dma_port: Fix NVM read buffer bounds and offset issue
This commit is contained in:
commit
e6809703e1
@ -366,15 +366,15 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address,
|
||||
void *buf, size_t size)
|
||||
{
|
||||
unsigned int retries = DMA_PORT_RETRIES;
|
||||
unsigned int offset;
|
||||
|
||||
offset = address & 3;
|
||||
address = address & ~3;
|
||||
|
||||
do {
|
||||
u32 nbytes = min_t(u32, size, MAIL_DATA_DWORDS * 4);
|
||||
unsigned int offset;
|
||||
size_t nbytes;
|
||||
int ret;
|
||||
|
||||
offset = address & 3;
|
||||
nbytes = min_t(size_t, size + offset, MAIL_DATA_DWORDS * 4);
|
||||
|
||||
ret = dma_port_flash_read_block(dma, address, dma->buf,
|
||||
ALIGN(nbytes, 4));
|
||||
if (ret) {
|
||||
@ -386,6 +386,7 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address,
|
||||
return ret;
|
||||
}
|
||||
|
||||
nbytes -= offset;
|
||||
memcpy(buf, dma->buf + offset, nbytes);
|
||||
|
||||
size -= nbytes;
|
||||
|
@ -68,15 +68,15 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size,
|
||||
unsigned int retries = USB4_DATA_RETRIES;
|
||||
unsigned int offset;
|
||||
|
||||
offset = address & 3;
|
||||
address = address & ~3;
|
||||
|
||||
do {
|
||||
size_t nbytes = min_t(size_t, size, USB4_DATA_DWORDS * 4);
|
||||
unsigned int dwaddress, dwords;
|
||||
u8 data[USB4_DATA_DWORDS * 4];
|
||||
size_t nbytes;
|
||||
int ret;
|
||||
|
||||
offset = address & 3;
|
||||
nbytes = min_t(size_t, size + offset, USB4_DATA_DWORDS * 4);
|
||||
|
||||
dwaddress = address / 4;
|
||||
dwords = ALIGN(nbytes, 4) / 4;
|
||||
|
||||
@ -87,6 +87,7 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size,
|
||||
return ret;
|
||||
}
|
||||
|
||||
nbytes -= offset;
|
||||
memcpy(buf, data + offset, nbytes);
|
||||
|
||||
size -= nbytes;
|
||||
|
Loading…
Reference in New Issue
Block a user