aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorWojciech Macek <wma@FreeBSD.org>2016-02-29 09:22:39 +0000
committerWojciech Macek <wma@FreeBSD.org>2016-02-29 09:22:39 +0000
commite571e15cb06e800b8360532b16406c8001a110ed (patch)
tree8f473b7ed4691fe398e44ade68a0d37d22739240 /sys/dev/fdt
parent6512e692786c2d017dba9f7d275ef6a7cb1aeb50 (diff)
downloadsrc-e571e15cb06e800b8360532b16406c8001a110ed.tar.gz
src-e571e15cb06e800b8360532b16406c8001a110ed.zip
Fix fdt_get_mem_regions() to work with 64-bit addresses
Use u_long instead of uint32_t variables to avoid overflow in case of PA space bigger than 32-bit. Obtained from: Semihalf Submitted by: Michal Stanek <mst@semihalf.com> Sponsored by: Annapurna Labs Approved by: cognet (mentor) Reviewed by: andrew, br, wma Differential revision: https://reviews.freebsd.org/D5393
Notes
Notes: svn path=/head/; revision=296189
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/fdt_common.c4
-rw-r--r--sys/dev/fdt/fdt_common.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c
index c7d33976bf39..4360fa134458 100644
--- a/sys/dev/fdt/fdt_common.c
+++ b/sys/dev/fdt/fdt_common.c
@@ -647,12 +647,12 @@ out:
}
int
-fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint32_t *memsize)
+fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, u_long *memsize)
{
pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS];
pcell_t *regp;
phandle_t memory;
- uint32_t memory_size;
+ u_long memory_size;
int addr_cells, size_cells;
int i, max_size, reg_len, rv, tuple_size, tuples;
diff --git a/sys/dev/fdt/fdt_common.h b/sys/dev/fdt/fdt_common.h
index 3eb33c19cf70..278244e189e2 100644
--- a/sys/dev/fdt/fdt_common.h
+++ b/sys/dev/fdt/fdt_common.h
@@ -85,7 +85,7 @@ u_long fdt_data_get(void *, int);
int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *);
phandle_t fdt_find_compatible(phandle_t, const char *, int);
phandle_t fdt_depth_search_compatible(phandle_t, const char *, int);
-int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *);
+int fdt_get_mem_regions(struct mem_region *, int *, u_long *);
int fdt_get_reserved_regions(struct mem_region *, int *);
int fdt_get_phyaddr(phandle_t, device_t, int *, void **);
int fdt_get_range(phandle_t, int, u_long *, u_long *);