Skip to contentSkip to conversation

uapi: fix definition of struct sockaddr_nfc_llcp on x32 and mips n32

PATCH In review Dmitry V. Levin 1 participant 2 messages Feb 20, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 uapi: fix definition of struct sockaddr_nfc_llcp on x32 and mips n32

Replace size_t with __kernel_size_t to fix definition of struct sockaddr_nfc_llcp on architectures like x32 and mips n32 where sizeof(size_t) < sizeof(__kernel_size_t).

This also fixes the following linux/nfc.h userspace compilation error:

/usr/include/linux/nfc.h:279:2: error: unknown type name 'size_t'
size_t service_name_len;

---
 include/uapi/linux/nfc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/nfc.h +1 -1
index 399f39f..f8ccc12 100644
@@ -276,7 +276,7 @@ struct sockaddr_nfc_llcp {
 	__u8 dsap; /* Destination SAP, if known */
 	__u8 ssap; /* Source SAP to be bound to */
 	char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
-	size_t service_name_len;
+	__kernel_size_t service_name_len;
 };
 
 /* NFC socket protocols */
Signature · 1 line
ldv
#1 lore raw
Quoted 20 lines · Dmitry V. Levin

Replace size_t with __kernel_size_t to fix definition of struct sockaddr_nfc_llcp on architectures like x32 and mips n32 where sizeof(size_t) < sizeof(__kernel_size_t).

This also fixes the following linux/nfc.h userspace compilation error:

/usr/include/linux/nfc.h:279:2: error: unknown type name 'size_t'
size_t service_name_len;

---
 include/uapi/linux/nfc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/nfc.h +0 -0
index 399f39f..f8ccc12 100644

include/uapi/linux/nfc.h struct sockaddr_nfc_llcp { · line 282

Quoted 8 lines
include/uapi/linux/nfc.h +1 -1
@@ -276,7 +276,7 @@ struct sockaddr_nfc_llcp {
 	__u8 dsap; /* Destination SAP, if known */
 	__u8 ssap; /* Source SAP to be bound to */
 	char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
-	size_t service_name_len;
+	__kernel_size_t service_name_len;
 };
 
 /* NFC socket protocols */

Unfortunately, this is not the right fix for the problem.

It was definitely a bad idea to use architecture dependent types in the definition of struct sockaddr_nfc_llcp. Somebody will have to implement a compat layer to make it work properly with x86, x32, and other compat personalities.

Signature · 1 line
ldv