drivers/net/r8168: Fix leaking memory from mapping
BUG=b:152157720,b:152459313 BRANCH=none TEST=none Change-Id: Ie79c3209d0be719ae1394e87efb357b84ce32840 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39855 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
2a82f744d4
commit
d08bc5ad7a
|
@ -117,6 +117,7 @@ static enum cb_err fetch_mac_vpd_key(u8 *macstrbuf, const char *vpd_key)
|
||||||
if (offset == search_length) {
|
if (offset == search_length) {
|
||||||
printk(BIOS_ERR,
|
printk(BIOS_ERR,
|
||||||
"Error: Could not locate '%s' in VPD\n", vpd_key);
|
"Error: Could not locate '%s' in VPD\n", vpd_key);
|
||||||
|
rdev_munmap(&rdev, search_address);
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
}
|
}
|
||||||
printk(BIOS_DEBUG, "Located '%s' in VPD\n", vpd_key);
|
printk(BIOS_DEBUG, "Located '%s' in VPD\n", vpd_key);
|
||||||
|
@ -124,10 +125,12 @@ static enum cb_err fetch_mac_vpd_key(u8 *macstrbuf, const char *vpd_key)
|
||||||
offset += strlen(vpd_key) + 1; /* move to next character */
|
offset += strlen(vpd_key) + 1; /* move to next character */
|
||||||
|
|
||||||
if (offset + MACLEN > search_length) {
|
if (offset + MACLEN > search_length) {
|
||||||
|
rdev_munmap(&rdev, search_address);
|
||||||
printk(BIOS_ERR, "Search result too small!\n");
|
printk(BIOS_ERR, "Search result too small!\n");
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
}
|
}
|
||||||
memcpy(macstrbuf, search_address + offset, MACLEN);
|
memcpy(macstrbuf, search_address + offset, MACLEN);
|
||||||
|
rdev_munmap(&rdev, search_address);
|
||||||
|
|
||||||
return CB_SUCCESS;
|
return CB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue