On Wed, 29 Sept 2021 at 10:49, Laurent Vivier <[email protected]> wrote:
>
> From: Mark Cave-Ayland <[email protected]>
>
> According to "Designing Cards and Drivers for the Macintosh Family" each
> physical
> nubus slot can access 2 separate address ranges: a super slot memory region
> which
> is 256MB and a standard slot memory region which is 16MB.
>
> Currently a Nubus device uses the physical slot number to determine whether
> it is
> using a standard slot memory region or a super slot memory region rather than
> exposing both memory regions for use as required.
> + /* Super */
> + slot_offset = nd->slot * NUBUS_SUPER_SLOT_SIZE;
Hi; Coverity thinks this multiply might overflow, because
we're calculating a hw_addr (64-bits) but the multiply is only
done at 32-bits. Adding an explicit cast or using 'ULL' in the
constant #define rather than just 'U' would fix this.
This is CID 1464070.
> +
> + name = g_strdup_printf("nubus-super-slot-%x", nd->slot);
> + memory_region_init(&nd->super_slot_mem, OBJECT(dev), name,
> + NUBUS_SUPER_SLOT_SIZE);
> + memory_region_add_subregion(&nubus->super_slot_io, slot_offset,
> + &nd->super_slot_mem);
> + g_free(name);
> +
> + /* Normal */
> + slot_offset = nd->slot * NUBUS_SLOT_SIZE;
Same with this one.
thanks
-- PMM