Skip to content

Commit ac96a15

Browse files
committed
modpost: fix ishtp MODULE_DEVICE_TABLE built on big-endian host
When MODULE_DEVICE_TABLE(ishtp, ) is built on a host with a different endianness from the target architecture, it results in an incorrect MODULE_ALIAS(). For example, see a case where drivers/platform/x86/intel/ishtp_eclite.c is built as a module for x86. If you build it on a little-endian host, you will get the correct MODULE_ALIAS: $ grep MODULE_ALIAS drivers/platform/x86/intel/ishtp_eclite.mod.c MODULE_ALIAS("ishtp:{6A19CC4B-D760-4DE3-B14D-F25EBD0FBCD9}"); However, if you build it on a big-endian host, you will get a wrong MODULE_ALIAS: $ grep MODULE_ALIAS drivers/platform/x86/intel/ishtp_eclite.mod.c MODULE_ALIAS("ishtp:{BD0FBCD9-F25E-B14D-4DE3-D7606A19CC4B}"); This issue has been unnoticed because the x86 kernel is most likely built natively on an x86 host. The guid field must not be reversed because guid_t is an array of __u8. Fixes: fa443bc ("HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE()") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
1 parent 7f54e00 commit ac96a15

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/mod/file2alias.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,10 +1401,10 @@ static int do_mhi_ep_entry(const char *filename, void *symval, char *alias)
14011401
/* Looks like: ishtp:{guid} */
14021402
static int do_ishtp_entry(const char *filename, void *symval, char *alias)
14031403
{
1404-
DEF_FIELD(symval, ishtp_device_id, guid);
1404+
DEF_FIELD_ADDR(symval, ishtp_device_id, guid);
14051405

14061406
strcpy(alias, ISHTP_MODULE_PREFIX "{");
1407-
add_guid(alias, guid);
1407+
add_guid(alias, *guid);
14081408
strcat(alias, "}");
14091409

14101410
return 1;

0 commit comments

Comments
 (0)