aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-12-15 16:24:59 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-12-15 16:24:59 +0100
commit47b8ded87e264e27d53c897e176784e4a688aaf9 (patch)
tree2f1ace532a36e2c826497244979fde06d0fc7f1c
parentcd38bcbf3eee46e6073729606c59e9e890a885fa (diff)
v4l2-ctl/compliance: fix 32-bit g_topology casts
Pointers should be cast to uintptr_t, not __u64, when assigning them to struct media_v2_topology. This avoids casting 0xff8cfb30 to 0xffffffffff8cfb30. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/common/media-info.cpp8
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp6
-rw-r--r--utils/v4l2-compliance/v4l2-test-media.cpp10
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-common.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl.cpp6
5 files changed, 16 insertions, 16 deletions
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index 97568e68..a5b429a0 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -428,10 +428,10 @@ static __u32 read_topology(int media_fd, __u32 major, __u32 minor,
media_v2_pad v2_pads[topology.num_pads];
media_v2_link v2_links[topology.num_links];
- topology.ptr_entities = (__u64)v2_ents;
- topology.ptr_interfaces = (__u64)v2_ifaces;
- topology.ptr_pads = (__u64)v2_pads;
- topology.ptr_links = (__u64)v2_links;
+ topology.ptr_entities = (uintptr_t)v2_ents;
+ topology.ptr_interfaces = (uintptr_t)v2_ifaces;
+ topology.ptr_pads = (uintptr_t)v2_pads;
+ topology.ptr_links = (uintptr_t)v2_links;
if (ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology))
return 0;
for (i = 0; i < topology.num_interfaces; i++)
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 5d7e4eda..023419db 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -860,11 +860,11 @@ static std::string make_devname(const char *device, const char *devname,
}
media_v2_entity *ents = new media_v2_entity[topology.num_entities];
- topology.ptr_entities = (__u64)ents;
+ topology.ptr_entities = (uintptr_t)ents;
media_v2_link *links = new media_v2_link[topology.num_links];
- topology.ptr_links = (__u64)links;
+ topology.ptr_links = (uintptr_t)links;
media_v2_interface *ifaces = new media_v2_interface[topology.num_interfaces];
- topology.ptr_interfaces = (__u64)ifaces;
+ topology.ptr_interfaces = (uintptr_t)ifaces;
unsigned i, ent_id, iface_id = 0;
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index a8b84b9a..79d1e00c 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -153,16 +153,16 @@ int testMediaTopology(struct node *node)
topology.ptr_links = 0;
v2_ents = new media_v2_entity[topology.num_entities];
memset(v2_ents, 0xff, topology.num_entities * sizeof(*v2_ents));
- topology.ptr_entities = (__u64)v2_ents;
+ topology.ptr_entities = (uintptr_t)v2_ents;
v2_ifaces = new media_v2_interface[topology.num_interfaces];
memset(v2_ifaces, 0xff, topology.num_interfaces * sizeof(*v2_ifaces));
- topology.ptr_interfaces = (__u64)v2_ifaces;
+ topology.ptr_interfaces = (uintptr_t)v2_ifaces;
v2_pads = new media_v2_pad[topology.num_pads];
memset(v2_pads, 0xff, topology.num_pads * sizeof(*v2_pads));
- topology.ptr_pads = (__u64)v2_pads;
+ topology.ptr_pads = (uintptr_t)v2_pads;
v2_links = new media_v2_link[topology.num_links];
memset(v2_links, 0xff, topology.num_links * sizeof(*v2_links));
- topology.ptr_links = (__u64)v2_links;
+ topology.ptr_links = (uintptr_t)v2_links;
fail_on_test(doioctl(node, MEDIA_IOC_G_TOPOLOGY, &topology));
fail_on_test(v2_ents != (media_v2_entity *)topology.ptr_entities);
fail_on_test(v2_ifaces != (media_v2_interface *)topology.ptr_interfaces);
@@ -536,7 +536,7 @@ void walkTopology(struct node &node, struct node &expbuf_node,
media_v2_interface v2_ifaces[topology.num_interfaces];
- topology.ptr_interfaces = (__u64)v2_ifaces;
+ topology.ptr_interfaces = (uintptr_t)v2_ifaces;
if (ioctl(node.g_fd(), MEDIA_IOC_G_TOPOLOGY, &topology))
return;
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index e079c274..7dd8fbfe 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -225,7 +225,7 @@ static void list_media_devices(const std::string &media_bus_info)
}
media_v2_interface *ifaces = new media_v2_interface[topology.num_interfaces];
- topology.ptr_interfaces = (__u64)ifaces;
+ topology.ptr_interfaces = (uintptr_t)ifaces;
if (!ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology))
for (unsigned i = 0; i < topology.num_interfaces; i++) {
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index aa4742c5..2a76176b 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -1050,11 +1050,11 @@ static const char *make_devname(const char *device, const char *devname,
}
media_v2_entity *ents = new media_v2_entity[topology.num_entities];
- topology.ptr_entities = (__u64)ents;
+ topology.ptr_entities = (uintptr_t)ents;
media_v2_link *links = new media_v2_link[topology.num_links];
- topology.ptr_links = (__u64)links;
+ topology.ptr_links = (uintptr_t)links;
media_v2_interface *ifaces = new media_v2_interface[topology.num_interfaces];
- topology.ptr_interfaces = (__u64)ifaces;
+ topology.ptr_interfaces = (uintptr_t)ifaces;
unsigned i, ent_id, iface_id = 0;

Privacy Policy