[Buildroot] [PATCH 1/1] package/libkcapi: fix uclibc build

Fabrice Fontaine fontaine.fabrice at gmail.com
Sun Nov 6 17:45:00 UTC 2022


Fix the following uclibc build failure raised since bump to version
1.4.0 in commit 06a9dc3528847ec6c12a9b6188d4106e086eabe5 and
https://github.com/smuellerDD/libkcapi/commit/12f19b9a1dd308117f83e8cb33e28e3c040710a0:

lib/kcapi-kernel-if.c: In function '_kcapi_common_send_meta':
lib/kcapi-kernel-if.c:196:26: error: conversion to 'int' from 'size_t' {aka 'unsigned int'} may change the sign of the result [-Werror=sign-conversion]
  196 |         msg.msg_iovlen = kcapi_downcast_int(iovlen);
      |                          ^~~~~~~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/eccf4b84670b5ef0fdd68b46338edf5043c7cc0d

Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
---
 ...b-kcapi-kernel-if.c-fix-uclibc-build.patch | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 package/libkcapi/0001-lib-kcapi-kernel-if.c-fix-uclibc-build.patch

diff --git a/package/libkcapi/0001-lib-kcapi-kernel-if.c-fix-uclibc-build.patch b/package/libkcapi/0001-lib-kcapi-kernel-if.c-fix-uclibc-build.patch
new file mode 100644
index 0000000000..9ec8373edd
--- /dev/null
+++ b/package/libkcapi/0001-lib-kcapi-kernel-if.c-fix-uclibc-build.patch
@@ -0,0 +1,50 @@
+From b70f31982c87f51bf4984b55149f0bc7934c0e6a Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Date: Sun, 6 Nov 2022 17:05:14 +0100
+Subject: [PATCH] lib/kcapi-kernel-if.c: fix uclibc build
+
+Fix the following uclibc build failure raised since version 1.4.0 and
+https://github.com/smuellerDD/libkcapi/commit/12f19b9a1dd308117f83e8cb33e28e3c040710a0:
+
+lib/kcapi-kernel-if.c: In function '_kcapi_common_send_meta':
+lib/kcapi-kernel-if.c:196:26: error: conversion to 'int' from 'size_t' {aka 'unsigned int'} may change the sign of the result [-Werror=sign-conversion]
+  196 |         msg.msg_iovlen = kcapi_downcast_int(iovlen);
+      |                          ^~~~~~~~~~~~~~~~~~
+
+Indeed, uclibc has the same behavior than musl event if it defines
+__GLIBC__
+
+Fixes:
+ - http://autobuild.buildroot.org/results/eccf4b84670b5ef0fdd68b46338edf5043c7cc0d
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+[Upstream status: https://github.com/smuellerDD/libkcapi/pull/145]
+---
+ lib/kcapi-kernel-if.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/kcapi-kernel-if.c b/lib/kcapi-kernel-if.c
+index d7b10bf..a475e44 100644
+--- a/lib/kcapi-kernel-if.c
++++ b/lib/kcapi-kernel-if.c
+@@ -119,7 +119,7 @@ int _kcapi_common_accept(struct kcapi_handle *handle)
+ 	return 0;
+ }
+ 
+-#ifdef __GLIBC__
++#if defined(__GLIBC__) && !defined(__UCLIBC__)
+ static inline size_t kcapi_downcast_int(size_t in)
+ {
+ 	return in;
+@@ -564,7 +564,7 @@ ssize_t _kcapi_common_recv_data(struct kcapi_handle *handle,
+ 	msg.msg_controllen = 0;
+ 	msg.msg_flags = 0;
+ 	msg.msg_iov = iov;
+-#ifdef __GLIBC__
++#if defined(__GLIBC__) && !defined(__UCLIBC__)
+ 	msg.msg_iovlen = iovlen;
+ #else
+ 	msg.msg_iovlen = (int)iovlen;
+-- 
+2.35.1
+
-- 
2.35.1




More information about the buildroot mailing list