modpost: Mark uuid_le type only for MEI
Subsystems (3)
Andy Shevchenko
reviewerPATCH 1/2 modpost: Mark uuid_le type only for MEI
The uuid_le type is used only for MEI ABI, do not advertise it for others. Due to above, bury add_uuid() in its only user.
--- scripts/mod/file2alias.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
scripts/mod/file2alias.c +13 -17
@@ -34,19 +34,22 @@ typedef Elf64_Addr kernel_ulong_t;typedef uint32_t __u32 ;typedef uint16_t __u16 ;typedef unsigned char __u8 ; +typedef struct {__u8 b[16 ]; }guid_t ; -/* backwards compatibility, don't use in new code */ -typedef struct { -__u8 b[16 ]; -}uuid_le ;typedef struct {__u8 b[16 ]; }uuid_t ; +#define UUID_STRING_LEN 36 +/* MEI UUID type, don't use anywhere else */ +typedef struct { +__u8 b[16 ]; +}uuid_le ; +/* Big exception to the "don't include kernel headers into userspace, which * even potentially has different endianness and word sizes, since * we handle those differences explicitly below */
@@ -104,17 +107,6 @@ static inline void add_wildcard(char *str)strcat (str + len,"*" ); } -static inline void add_uuid (char *str,uuid_le uuid) -{ -int len =strlen (str); - -sprintf (str + len,"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" , - uuid.b[3 ], uuid.b[2 ], uuid.b[1 ], uuid.b[0 ], - uuid.b[5 ], uuid.b[4 ], uuid.b[7 ], uuid.b[6 ], - uuid.b[8 ], uuid.b[9 ], uuid.b[10 ], uuid.b[11 ], - uuid.b[12 ], uuid.b[13 ], uuid.b[14 ], uuid.b[15 ]); -} -/** * Check that sizeof(device_id type) are consistent with size of section * in .o file. If in-consistent then userspace and kernel does not agree
@@ -1198,12 +1190,16 @@ static int do_mei_entry(const char *filename, void *symval, char *alias) {DEF_FIELD_ADDR (symval, mei_cl_device_id, name); -DEF_FIELD_ADDR (symval, mei_cl_device_id, uuid); +DEF_FIELD (symval, mei_cl_device_id, uuid);DEF_FIELD (symval, mei_cl_device_id, version);sprintf (alias,MEI_CL_MODULE_PREFIX );sprintf (alias +strlen (alias),"%s:" , (*name)[0 ] ? *name :"*" ); -add_uuid (alias, *uuid); +sprintf (alias +strlen (alias),"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" , + uuid.b[3 ], uuid.b[2 ], uuid.b[1 ], uuid.b[0 ], + uuid.b[5 ], uuid.b[4 ], uuid.b[7 ], uuid.b[6 ], + uuid.b[8 ], uuid.b[9 ], uuid.b[10 ], uuid.b[11 ], + uuid.b[12 ], uuid.b[13 ], uuid.b[14 ], uuid.b[15 ]);ADD (alias,":" , version !=MEI_CL_VERSION_ANY , version);strcat (alias,":*" );
Signature · 1 line
2.28.0
Andy Shevchenko
reviewerPATCH 2/2 uuid: Make guid_t completely internal type to the kernel
The guid_t type was defined in UAPI by mistake.
Keep it an internal type and leave uuid_le UAPI
for it's only user, i.e. MEI.
--- include/linux/uuid.h | 16 ++++++++++++++-- include/uapi/linux/uuid.h | 14 +++++--------- 2 files changed, 19 insertions(+), 11 deletions(-)
include/linux/uuid.h +14 -2
@@ -8,15 +8,25 @@#ifndef _LINUX_UUID_H_#define _LINUX_UUID_H_ -#include <uapi/linux/uuid.h> #include <linux/string.h> #define UUID_SIZE 16 +typedef struct { +__u8 b[UUID_SIZE ]; +}guid_t ; +typedef struct {__u8 b[UUID_SIZE ]; }uuid_t ; +#define GUID_INIT (a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ +((guid_t) \ +{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ + (b) & 0xff, ((b) >> 8) & 0xff, \ + (c) & 0xff, ((c) >> 8) & 0xff, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) +#define UUID_INIT (a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((uuid_t) \ {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
@@ -97,7 +107,9 @@ extern const u8 uuid_index[16];int guid_parse (const char *uuid,guid_t *u);int uuid_parse (const char *uuid,uuid_t *u); -/* backwards compatibility, don't use in new code */ +/* MEI UUID type, don't use anywhere else */ +#include <uapi/linux/uuid.h> +static inline int uuid_le_cmp (const guid_t u1,const guid_t u2) {return memcmp (&u1, &u2,sizeof (guid_t));
include/uapi/linux/uuid.h +5 -9
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* -* UUID/GUID definition +* MEI UUID definition * * Copyright (C) 2010, Intel Corp. * Huang Ying <[email protected]>
@@ -22,21 +22,17 @@typedef struct {__u8 b[16 ]; -}guid_t ; +}uuid_le ; -#define GUID_INIT (a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ -((guid_t) \ +#define UUID_LE (a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ +((uuid_le) \ {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ (b) & 0xff, ((b) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) -/* backwards compatibility, don't use in new code */ -typedef guid_t uuid_le ; -#define UUID_LE (a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)#define NULL_UUID_LE \ UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00) + 0x00, 0x00, 0x00, 0x00)#endif /* _UAPI_LINUX_UUID_H_ */
Signature · 1 line
2.28.0
Andy Shevchenko
reviewerRe: [PATCH v1 2/2] uuid: Make guid_t completely internal type to the kernel
Quoted 3 lines · Andy Shevchenko
The
guid_ttype was defined in UAPI by mistake.
Keep it an internal type and leaveuuid_leUAPI
for it's only user, i.e. MEI.
...
Quoted 3 lines
static inline int
uuid_le_cmp(const guid_t u1, const guid_t u2){
returnmemcmp(&u1, &u2, sizeof(guid_t));
This also has to be changed... (though it compiles).
I'll send v2.
Signature · 2 lines
With Best Regards, Andy Shevchenko
kernel test robot
build botRe: [PATCH v1 2/2] uuid: Make guid_t completely internal type to the kernel
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on hch-configfs/for-next]
[also build test ERROR on linus/master v5.10-rc1 next-20201030] [cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/modpost-Mark-uuid_le-type-only-for-MEI/20201031-221811 base: git://git.infradead.org/users/hch/configfs.git for-next config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/b3ed5f445f0427adad04815a6c42982ef1f5926f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Andy-Shevchenko/modpost-Mark-uuid_le-type-only-for-MEI/20201031-221811 git checkout b3ed5f445f0427adad04815a6c42982ef1f5926f # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/misc/mei/client.c: In function '__mei_me_cl_by_uuid':
>> drivers/misc/mei/client.c:141:19: error: incompatible type for argument 1 of 'uuid_le_cmp'
141 | if (uuid_le_cmp(*uuid, *pn) == 0)
| ^~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from include/uapi/linux/mei.h:10,
from drivers/misc/mei/client.c:13:
include/linux/uuid.h:113:44: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/client.c:141:26: error: incompatible type for argument 2 of 'uuid_le_cmp'
141 | if (uuid_le_cmp(*uuid, *pn) == 0)
| ^~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from include/uapi/linux/mei.h:10,
from drivers/misc/mei/client.c:13:
include/linux/uuid.h:113:61: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/client.c: In function '__mei_me_cl_by_uuid_id':
drivers/misc/mei/client.c:221:19: error: incompatible type for argument 1 of 'uuid_le_cmp'
221 | if (uuid_le_cmp(*uuid, *pn) == 0 &&
| ^~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from include/uapi/linux/mei.h:10,
from drivers/misc/mei/client.c:13:
include/linux/uuid.h:113:44: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/client.c:221:26: error: incompatible type for argument 2 of 'uuid_le_cmp'
221 | if (uuid_le_cmp(*uuid, *pn) == 0 &&
| ^~~
| |
| uuid_le {aka const struct <anonymous>} In file included from include/uapi/linux/mei.h:10,
from drivers/misc/mei/client.c:13:
include/linux/uuid.h:113:61: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
--
In file included from include/linux/uuid.h:111,
from include/linux/mei_cl_bus.h:9,
from drivers/misc/mei/bus.c:16:
drivers/misc/mei/bus.c: In function 'mei_cl_device_find':
>> include/uapi/linux/uuid.h:28:1: error: incompatible type for argument 1 of 'uuid_le_cmp'
28 | ((uuid_le) \
| ^~~~~~~~~~~~~~~~~~~
| |
| uuid_le {aka struct <anonymous>}
29 | {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 | (b) & 0xff, ((b) >> 8) & 0xff, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 | (c) & 0xff, ((c) >> 8) & 0xff, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 | (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/uapi/linux/uuid.h:35:2: note: in expansion of macro 'UUID_LE'
35 | UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
| ^~~~~~~
drivers/misc/mei/bus.c:630:21: note: in expansion of macro 'NULL_UUID_LE'
630 | while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) {
| ^~~~~~~~~~~~
In file included from include/linux/mei_cl_bus.h:9,
from drivers/misc/mei/bus.c:16:
include/linux/uuid.h:113:44: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
>> drivers/misc/mei/bus.c:630:37: error: incompatible type for argument 2 of 'uuid_le_cmp'
630 | while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) {
| ~~^~~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from include/linux/mei_cl_bus.h:9,
from drivers/misc/mei/bus.c:16:
include/linux/uuid.h:113:61: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/bus.c:631:20: error: incompatible type for argument 1 of 'uuid_le_cmp'
631 | if (!uuid_le_cmp(*uuid, id->uuid)) {
| ^~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from include/linux/mei_cl_bus.h:9,
from drivers/misc/mei/bus.c:16:
include/linux/uuid.h:113:44: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/bus.c:631:29: error: incompatible type for argument 2 of 'uuid_le_cmp'
631 | if (!uuid_le_cmp(*uuid, id->uuid)) {
| ~~^~~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from include/linux/mei_cl_bus.h:9,
from drivers/misc/mei/bus.c:16: include/linux/uuid.h:113:61: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
--
drivers/misc/mei/bus-fixup.c: In function 'mei_cl_bus_dev_fixup':
>> drivers/misc/mei/bus-fixup.c:495:20: error: incompatible type for argument 1 of 'uuid_le_cmp'
495 | if (uuid_le_cmp(f->uuid, MEI_UUID_ANY) == 0 ||
| ~^~~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from drivers/misc/mei/bus-fixup.c:12:
include/linux/uuid.h:113:44: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
In file included from include/linux/uuid.h:111,
from drivers/misc/mei/bus-fixup.c:12:
include/uapi/linux/uuid.h:28:1: error: incompatible type for argument 2 of 'uuid_le_cmp'
28 | ((uuid_le) \
| ^~~~~~~~~~~~~~~~~~~
| |
| uuid_le {aka struct <anonymous>}
29 | {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 | (b) & 0xff, ((b) >> 8) & 0xff, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 | (c) & 0xff, ((c) >> 8) & 0xff, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 | (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/uapi/linux/uuid.h:35:2: note: in expansion of macro 'UUID_LE'
35 | UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
| ^~~~~~~
drivers/misc/mei/bus-fixup.c:36:22: note: in expansion of macro 'NULL_UUID_LE'
36 | #define MEI_UUID_ANY NULL_UUID_LE
| ^~~~~~~~~~~~
drivers/misc/mei/bus-fixup.c:495:28: note: in expansion of macro 'MEI_UUID_ANY'
495 | if (uuid_le_cmp(f->uuid, MEI_UUID_ANY) == 0 ||
| ^~~~~~~~~~~~
In file included from drivers/misc/mei/bus-fixup.c:12:
include/linux/uuid.h:113:61: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/bus-fixup.c:496:20: error: incompatible type for argument 1 of 'uuid_le_cmp'
496 | uuid_le_cmp(f->uuid, *uuid) == 0)
| ~^~~~~~
| |
| uuid_le {aka const struct <anonymous>}
In file included from drivers/misc/mei/bus-fixup.c:12:
include/linux/uuid.h:113:44: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
drivers/misc/mei/bus-fixup.c:496:28: error: incompatible type for argument 2 of 'uuid_le_cmp'
496 | uuid_le_cmp(f->uuid, *uuid) == 0)
| ^~~~~
| |
| uuid_le {aka const struct <anonymous>} In file included from drivers/misc/mei/bus-fixup.c:12:
include/linux/uuid.h:113:61: note: expected 'guid_t' {aka 'const struct <anonymous>'} but argument is of type 'uuid_le' {aka 'const struct <anonymous>'}
113 | static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
| ~~~~~~~~~~~~~^~
vim +/uuid_le_cmp +141 drivers/misc/mei/client.c
b7d885145538dd Tomas Winkler 2015-02-10 119
b7d885145538dd Tomas Winkler 2015-02-10 120 /**
b7d885145538dd Tomas Winkler 2015-02-10 121 * __mei_me_cl_by_uuid - locate me client by uuid
79563db9ddd379 Tomas Winkler 2015-01-11 122 * increases ref count
90e0b5f18569bd Tomas Winkler 2013-01-08 123 *
90e0b5f18569bd Tomas Winkler 2013-01-08 124 * @dev: mei device
a8605ea2c20c2b Alexander Usyskin 2014-09-29 125 * @uuid: me client uuid
a27a76d3c07de0 Alexander Usyskin 2014-02-17 126 *
a8605ea2c20c2b Alexander Usyskin 2014-09-29 127 * Return: me client or NULL if not found
b7d885145538dd Tomas Winkler 2015-02-10 128 *
b7d885145538dd Tomas Winkler 2015-02-10 129 * Locking: dev->me_clients_rwsem
90e0b5f18569bd Tomas Winkler 2013-01-08 130 */
b7d885145538dd Tomas Winkler 2015-02-10 131 static struct mei_me_client *__mei_me_cl_by_uuid(struct mei_device *dev,
d320832f646660 Tomas Winkler 2014-08-24 132 const uuid_le *uuid)
90e0b5f18569bd Tomas Winkler 2013-01-08 133 {
5ca2d3882d60c0 Tomas Winkler 2014-08-21 134 struct mei_me_client *me_cl;
b7d885145538dd Tomas Winkler 2015-02-10 135 const uuid_le *pn;
90e0b5f18569bd Tomas Winkler 2013-01-08 136
b7d885145538dd Tomas Winkler 2015-02-10 137 WARN_ON(!rwsem_is_locked(&dev->me_clients_rwsem));
b7d885145538dd Tomas Winkler 2015-02-10 138
b7d885145538dd Tomas Winkler 2015-02-10 139 list_for_each_entry(me_cl, &dev->me_clients, list) {
b7d885145538dd Tomas Winkler 2015-02-10 140 pn = &me_cl->props.protocol_name;
b7d885145538dd Tomas Winkler 2015-02-10 @141 if (uuid_le_cmp(*uuid, *pn) == 0)
79563db9ddd379 Tomas Winkler 2015-01-11 142 return mei_me_cl_get(me_cl);
b7d885145538dd Tomas Winkler 2015-02-10 143 }
90e0b5f18569bd Tomas Winkler 2013-01-08 144
d320832f646660 Tomas Winkler 2014-08-24 145 return NULL;
90e0b5f18569bd Tomas Winkler 2013-01-08 146 }
90e0b5f18569bd Tomas Winkler 2013-01-08 147 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Andy Shevchenko
reviewerRe: [PATCH v1 2/2] uuid: Make guid_t completely internal type to the kernel
Quoted 10 lines · kernel test robot
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on hch-configfs/for-next]
[also build test ERROR on linus/master v5.10-rc1 next-20201030] [cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
Thanks, there is v2 which should have no such issue.
Signature · 2 lines
With Best Regards, Andy Shevchenko