Attention is currently required from: Nico Huber, Edward O'Callaghan, Martin Roth.

Edward O'Callaghan uploaded patch set #2 to this change.

View Change

programmer: Use correct type for flashbase

The flashbase is a machine-sized integer representation of
address space and so use the appropriate type that is correctly
sized to encode such data.

The flashbase is assigned to 'base' in 'map_flash()' and the
type correctly changed to uintptr_t in commit 4e32ec19b124a7
therefore makes for a consistent type usage whenever stored.

While `sizeof(unsigned long)` and `sizeof(uintptr_t)` are both `8` under
most circumstances on a 64bit platform and thus have enough bits to
represent all addresses on the platform, the C standard does not
guarantee this. Only `uintptr_t` and `void *` has a guaranteed
isomorphism as `uintptr_t` is defined by the platforms toolchain support
whereas the conversion from `void *` to an integer is implementation
defined and that the memory address value may contain additional bits
describing the validation data or provenance of the address. Therefore a
integer is insufficient to contain all the necessary information for
that specific platform so this may not always work out for all platforms
and toolchain combinations.

Spotted-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Change-Id: Ib9057e438731b9cccde0e24d5c8f758c3af1d47f
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M flashrom.c
M include/programmer.h
2 files changed, 34 insertions(+), 2 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/28/75328/2

To view, visit change 75328. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ib9057e438731b9cccde0e24d5c8f758c3af1d47f
Gerrit-Change-Number: 75328
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Martin Roth <martin.roth@amd.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Nico Huber <nico.h@gmx.de>
Gerrit-Attention: Nico Huber <nico.h@gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Attention: Martin Roth <martin.roth@amd.corp-partner.google.com>
Gerrit-MessageType: newpatchset