mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 23:51:33 +00:00
net: designware: clear padding bytes
Short frames are padded to the minimum allowed size of 60 bytes. However, the designware driver sends old data in these padding bytes. It is common practice to zero out these padding bytes ro prevent leaking memory contents to other hosts. Fix the padding code to zero out the padded bytes at the end. Tested on socfpga gen5. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
ae8ac8d423
commit
7efb75b114
1 changed files with 4 additions and 2 deletions
|
@ -380,9 +380,11 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
|
|||
return -EPERM;
|
||||
}
|
||||
|
||||
length = max(length, ETH_ZLEN);
|
||||
|
||||
memcpy((void *)data_start, packet, length);
|
||||
if (length < ETH_ZLEN) {
|
||||
memset(&((char *)data_start)[length], 0, ETH_ZLEN - length);
|
||||
length = ETH_ZLEN;
|
||||
}
|
||||
|
||||
/* Flush data to be sent */
|
||||
flush_dcache_range(data_start, data_end);
|
||||
|
|
Loading…
Reference in a new issue