[PATCH 1/2] drm/radeon: Using unsigned long instead of unsigned to fix possible overflow

Alex Deucher alexdeucher at gmail.com
Fri Nov 4 18:31:01 UTC 2022


On Fri, Nov 4, 2022 at 6:05 AM Hanjun Guo <guohanjun at huawei.com> wrote:
>
> VBIOSImageOffset in struct UEFI_ACPI_VFCT is ULONG (unsigned long),
> but it will be assigned to "unsigned offset", so use unsigned long
> instead of unsigned for the offset, to avoid possible overflow.

ULONG in atombios is 32 bits so an int should be fine.

Alex

>
> Signed-off-by: Hanjun Guo <guohanjun at huawei.com>
> ---
>  drivers/gpu/drm/radeon/radeon_bios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
> index 3312165..520d1d6 100644
> --- a/drivers/gpu/drm/radeon/radeon_bios.c
> +++ b/drivers/gpu/drm/radeon/radeon_bios.c
> @@ -611,7 +611,7 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
>         struct acpi_table_header *hdr;
>         acpi_size tbl_size;
>         UEFI_ACPI_VFCT *vfct;
> -       unsigned offset;
> +       unsigned long offset;
>
>         if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr)))
>                 return false;
> --
> 1.7.12.4
>


More information about the amd-gfx mailing list