Skip to contentSkip to conversation

package/libcamera-apps: fix overflow conversion error

PATCH Applied Marcus Folkesson 2 participants 2 messages Jan 31, 2023 – Feb 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libcamera-apps: fix overflow conversion error

Upstream commit:
https://github.com/raspberrypi/libcamera-apps/commit/a65682a97e19f96b86aeceb3ca3befb1687e3861

Fixes:
- http://autobuild.buildroot.net/results/758631a9fcd62835844f78914a36dfb579e7beba/

---
 ...ass-VIDIOC_QUERYCAP-as-unsigned-long.patch | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/libcamera-apps/0001-core-pass-VIDIOC_QUERYCAP-as-unsigned-long.patch
package/libcamera-apps/0001-core-pass-VIDIOC_QUERYCAP-as-unsigned-long.patch new file +34 -0
new file mode 100644
index 0000000000..2f4b6424a1
@@ -0,0 +1,34 @@
+From a65682a97e19f96b86aeceb3ca3befb1687e3861 Mon Sep 17 00:00:00 2001
+From: Marcus Folkesson <[email protected]>
+Date: Tue, 31 Jan 2023 09:14:15 +0100
+Subject: [PATCH] core: pass VIDIOC_QUERYCAP as unsigned long
+
+VIDIOC_QUARYCAP is an unsigned long and should be passed as one.
+
+Get rid of the following error:
+core/libcamera_app.cpp:33:22: error: overflow in conversion from 'long unsigned int' to 'int' changes value from '2154321408' to '-2140645888' [-Werror=overflow]
+   33 |  int ret = ioctl(fd, VIDIOC_QUERYCAP, &caps);
+
+Signed-off-by: Marcus Folkesson <[email protected]>
+---
+ core/libcamera_app.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/core/libcamera_app.cpp b/core/libcamera_app.cpp
+index 04696fb..8cb6563 100644
+--- a/core/libcamera_app.cpp
++++ b/core/libcamera_app.cpp
+@@ -30,7 +30,9 @@ static void check_camera_stack()
+ 		return;
+ 
+ 	v4l2_capability caps;
+-	int ret = ioctl(fd, VIDIOC_QUERYCAP, &caps);
++	unsigned long request = VIDIOC_QUERYCAP;
++
++	int ret = ioctl(fd, request, &caps);
+ 	close(fd);
+ 
+ 	if (ret < 0 || strcmp((char *)caps.driver, "bm2835 mmal"))
+-- 
+2.38.1
+
Signature · 6 lines
2.38.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 11 lines · On Tue, 31 Jan 2023 14:36:26 +0100 Marcus Folkesson…

Upstream commit:
https://github.com/raspberrypi/libcamera-apps/commit/a65682a97e19f96b86aeceb3ca3befb1687e3861

Fixes:
- http://autobuild.buildroot.net/results/758631a9fcd62835844f78914a36dfb579e7beba/

---
 ...ass-VIDIOC_QUERYCAP-as-unsigned-long.patch | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/libcamera-apps/0001-core-pass-VIDIOC_QUERYCAP-as-unsigned-long.patch

Applied to master after adding a link to the upstream commit in the patch itself. Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot