mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hans de Goede <hdegoede@redhat.com>,
	Jiri Kosina <jkosina@suse.cz>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH 2/5] modpost: fix ishtp MODULE_DEVICE_TABLE built on big endian host
Date: Sun, 8 Oct 2023 09:51:45 +0200	[thread overview]
Message-ID: <79f74670-768b-46f7-b484-a45ddcd9dc6f@t-8ch.de> (raw)
In-Reply-To: <20231007170448.505487-2-masahiroy@kernel.org>

On 2023-10-08 02:04:45+0900, Masahiro Yamada wrote:
> 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.

Nitpick:

... [as a module] for x86.

So the statements below can be interpreted correctly.

> 
> 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: fa443bc3c1e4 ("HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE()")

+ Cc: stable@vger.kernel.org

> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>

Thanks!

> ---
> 
>  scripts/mod/file2alias.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 70bf6a2f585c..6583b36dbe69 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -1401,10 +1401,10 @@ static int do_mhi_ep_entry(const char *filename, void *symval, char *alias)
>  /* Looks like: ishtp:{guid} */
>  static int do_ishtp_entry(const char *filename, void *symval, char *alias)
>  {
> -	DEF_FIELD(symval, ishtp_device_id, guid);
> +	DEF_FIELD_ADDR(symval, ishtp_device_id, guid);
>  
>  	strcpy(alias, ISHTP_MODULE_PREFIX "{");
> -	add_guid(alias, guid);
> +	add_guid(alias, *guid);
>  	strcat(alias, "}");
>  
>  	return 1;
> -- 
> 2.39.2
> 

  reply	other threads:[~2023-10-08  7:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07 17:04 [PATCH 1/5] modpost: fix tee " Masahiro Yamada
2023-10-07 17:04 ` [PATCH 2/5] modpost: fix ishtp " Masahiro Yamada
2023-10-08  7:51   ` Thomas Weißschuh [this message]
2023-10-09 16:50     ` srinivas pandruvada
2023-10-14 14:38     ` Masahiro Yamada
2023-10-07 17:04 ` [PATCH 3/5] modpost: define TO_NATIVE() using bswap_* functions Masahiro Yamada
2023-10-09 17:43   ` Nick Desaulniers
2023-10-14 14:16     ` Masahiro Yamada
2023-10-07 17:04 ` [PATCH 4/5] modpost: refactor check_sec_ref() Masahiro Yamada
2023-10-07 17:04 ` [PATCH 5/5] modpost: factor out the common boilerplate of section_rel(a) Masahiro Yamada
2023-10-09  6:27 ` [PATCH 1/5] modpost: fix tee MODULE_DEVICE_TABLE built on big endian host Sumit Garg
2023-10-09  6:57   ` Masahiro Yamada
2023-10-09  9:24     ` Sumit Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79f74670-768b-46f7-b484-a45ddcd9dc6f@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=hdegoede@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®