Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1062847rdb; Sat, 7 Oct 2023 10:05:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHa9Iw1l2UVnqrxkvy+zoi+olv3EkGpxTt186KGLd1KV8LPwskkKgF6qpsel6GxjGVk2vs X-Received: by 2002:a17:903:234f:b0:1c3:a4f2:7c84 with SMTP id c15-20020a170903234f00b001c3a4f27c84mr11801846plh.60.1696698304557; Sat, 07 Oct 2023 10:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696698304; cv=none; d=google.com; s=arc-20160816; b=O+uBiHMxOSA7Q/FAIBt4Fv4F7aG7scC5JsM91YhKf71LCIB4WM3B2miu2va+LC5Eku epWCRmzsao710faD6YKgN82CNjVWz1vSB67i3MioGEfODGTTUzfcB50QRQtH8Ihq4FGV gmKumWTO0Ad5Pu3IgrQzjK0A9dUWDCJvVWmz7nNwSBIXEZ74L8tLhQJ0Fnu0YhxE6gXg ASQCLuGBCyJbpNJcQN4P8/D6ly+p+c+kkdiPPtAC1DSRTfGsLwyNN2JMkYA01zPCV5XV EdNpz842zL+xfkJglHhTdFYeqnJfHwOsu+lIKGbBK7ZVeBPfz/q0UWUtS8r07ty8qfrw ukBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8nEY8eNt0wOkmINbls4UM258fyfw7VxyfhsVq9XFVxg=; fh=XbpaCPHBafLZZrtF5rhcMEkabNxxoWT6OCJYwZ5VqdU=; b=nXCWydoROTLLVGCP/blzWG4IVeAagq9qlhHtV9NsJoYZEZfW0ML4U7ayEWcyKWEbmV /1ACVnWT85fxr0VSi1R82EsKFZKtyDm5G6lgq2xmMSvyBhXyuabvNkLL1VtaNHmQwHox 306X6/VD8OnaKgh9+CbMOmSC6VZ+SD/7vZNmfruuSUt6DreL5cbZThsaPTs3egiuLsug sbhQXW6nSsPqIo19DDMozmAedH1BP2/5itDUCO7bJJviHuSrUh8lnyYIxWSsW/Xwg12R NrCQEzD4Mz1j4H3oioWq/elApFUovjve6O1B8LIcMh0H5fn9oil8ZwwJ9tNosnnvrdXB Sj6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eUeSBoRC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x3-20020a17090300c300b001c3cbccf116si5820671plc.403.2023.10.07.10.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 10:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eUeSBoRC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BD10C80BBC67; Sat, 7 Oct 2023 10:05:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344094AbjJGRFB (ORCPT + 99 others); Sat, 7 Oct 2023 13:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344046AbjJGRE6 (ORCPT ); Sat, 7 Oct 2023 13:04:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12F0BBA; Sat, 7 Oct 2023 10:04:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDADAC433C7; Sat, 7 Oct 2023 17:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696698297; bh=13ShY6HnWg7Sx2I9hscgBsQOpo9Vq3faGjdLVYoBM5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUeSBoRC8ODJTmKIkYd6gNHF/IrKY8Gdzo0GJtWGKXvn/Gwxg66E66zwK+R+L641h RH91OtdShkzWHuMANps+J8Tk/390bUD43IXxpuXrUmzlZ05XTXonzNYEnWWPx7X41M 2yz+S0Ez0O60sxYV+gxrOXChiiB5dI2NdlKFf2mSvqGCjH5w5iO1wDyObNm6wVEK1y 8CafTp2S7rUo6l50QfyjmNHtmXI+FjjRaK7qOO11kQeSR4vpSHgoIaidgiPSnAlanS dThJcqOhH5Y0mQPS4fb8cu0vCfja+eoOcDBKuq1Iab/VnMOtrRwqUseRmQm0ueA0/L 8jdcl8NIkKFpA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Hans de Goede , Jiri Kosina , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Srinivas Pandruvada , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Subject: [PATCH 2/5] modpost: fix ishtp MODULE_DEVICE_TABLE built on big endian host Date: Sun, 8 Oct 2023 02:04:45 +0900 Message-Id: <20231007170448.505487-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231007170448.505487-1-masahiroy@kernel.org> References: <20231007170448.505487-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 07 Oct 2023 10:05:03 -0700 (PDT) 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. 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()") Signed-off-by: Masahiro Yamada --- 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