mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
acpi_table: Fix coverity defect in acpi_write_spcr
Fix "Integer handling issues (SIGN_EXTENSION)" in newly added code: Cast serial_info.reg_offset to u64 to prevent an integer overflow when shifted too many bits to the left. Currently this never happens as the shift is supposed to be less than 4. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Moritz Fischer <moritzf@google.com>
This commit is contained in:
parent
f2533fb048
commit
e1c3c720e7
1 changed files with 2 additions and 2 deletions
|
@ -420,7 +420,7 @@ int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev,
|
|||
static int acpi_write_spcr(struct acpi_ctx *ctx, const struct acpi_writer *entry)
|
||||
{
|
||||
struct serial_device_info serial_info = {0};
|
||||
ulong serial_address, serial_offset;
|
||||
u64 serial_address, serial_offset;
|
||||
struct acpi_table_header *header;
|
||||
struct acpi_spcr *spcr;
|
||||
struct udevice *dev;
|
||||
|
@ -473,7 +473,7 @@ static int acpi_write_spcr(struct acpi_ctx *ctx, const struct acpi_writer *entry
|
|||
}
|
||||
|
||||
serial_width = serial_info.reg_width * 8;
|
||||
serial_offset = serial_info.reg_offset << serial_info.reg_shift;
|
||||
serial_offset = ((u64)serial_info.reg_offset) << serial_info.reg_shift;
|
||||
serial_address = serial_info.addr + serial_offset;
|
||||
|
||||
/* Encode register access size */
|
||||
|
|
Loading…
Add table
Reference in a new issue