Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1300271rdb; Sun, 8 Oct 2023 00:55:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvRZtuWGYmZZnZLA1IU6zeLUeU1u8FZ5G6FGRgHSZUDELicqrn3ostFW9xUW8WtQ0TLxIe X-Received: by 2002:a17:902:b943:b0:1c5:cbfb:c166 with SMTP id h3-20020a170902b94300b001c5cbfbc166mr13396872pls.37.1696751713231; Sun, 08 Oct 2023 00:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696751713; cv=none; d=google.com; s=arc-20160816; b=dKi9GsGvxFhM7z6vi2Q0lk9IlPy/c+AreHtgwbpzqm3lCRr+art+PEy52yddL7Ov66 SpLy77BBbR3dwlSwBM98hJu9g/NFUKbejxbJPi26iRHiWSoP7/+QtdL2cL7bbr7HMsGj wROaDZyREyeDBtj0/ulMv0yu5ZquHPf5r+nFtvLkgDqT7vKSJjStSMGy3wiu1bYu8F+g aPBytQzp5/D5Y3yfFqJqvdA/a1Uet5Gjjg/K4aiRfVIhbKmBa82Uk8SO49TFZ0XW1d+d aVOixBYOu0Trm+v3cwe2e/+UIvxOManMHIqmVSMV5Jte7QX9Xxamd/nmLfac+J7Nw4Aj QMog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OSO+Jxz2omeiOFtUnXvBqWqCr+/OaDPUtje7u2kOWJ8=; fh=gISdiveXDeqtdqKSMhTBz90DarJB9GzhrcssC1nlQzg=; b=TzhZn+kISIniis1luFMgBmGS8ArVBuAQxibTQ4tMszF1j+RvdD0RsIThJrUOVSytKq QU7A3URRPm9UIhDmsNlX3INiWUw7yKTs46/bVNmXFFL1Yo+R9TLkdB4ZWLxoH6b88v/z jvBPxfbyzcJJ0S/1o1rS670gSn1xBQ90Q/Zo4yaBLyfw8MCff4QCJpTxx0AwDgTk5A43 6oW4YcEM5Cxfgk2olNR9rp8ueduqVV+xsl7v+iFgTPLYavWJQQQ7Yo495Z/PFLKO5QDq Yy8mpaDwlfDvtGIRjB0OA5jkk/Wjr60gwA9E1zdm1yTbMjX6HDwNL0GUPq1hv48EpkxO e9wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RD222CdQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id r10-20020a1709028bca00b001c74d83470bsi7035918plo.206.2023.10.08.00.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 00:55:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RD222CdQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B72CE803DAFB; Sun, 8 Oct 2023 00:55:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344497AbjJHHvw (ORCPT + 99 others); Sun, 8 Oct 2023 03:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjJHHvv (ORCPT ); Sun, 8 Oct 2023 03:51:51 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE9D7C5; Sun, 8 Oct 2023 00:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1696751506; bh=BgY4vzub1HaZeHO6+TU8wMKwHTfa845EGfX4ZXvUfTo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RD222CdQZNi3cZRdnZz+lZ5S8ZgKXWTAcyHHWABjJI1BXxsNbtt3fIgL7srE4oN1w qXG4HUB2LKM7JCwqeTqrpPznbAVuuFKqFrCLRBCGrskHWL8pNm0ZCgIQ8/nPSbG3GX Y5QAtvzdfmT4pUKqmhLQ/VyfvDnhjVlA5n5ioLII= Date: Sun, 8 Oct 2023 09:51:45 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Hans de Goede , Jiri Kosina , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Srinivas Pandruvada Subject: Re: [PATCH 2/5] modpost: fix ishtp MODULE_DEVICE_TABLE built on big endian host Message-ID: <79f74670-768b-46f7-b484-a45ddcd9dc6f@t-8ch.de> References: <20231007170448.505487-1-masahiroy@kernel.org> <20231007170448.505487-2-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231007170448.505487-2-masahiroy@kernel.org> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 08 Oct 2023 00:55:08 -0700 (PDT) X-Spam-Level: ** 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 Reviewed-by: Thomas Weißschuh 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 >