Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp265167rdd; Wed, 22 Nov 2023 15:40:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe1WMMKCS9sM69fGS6O0hyu5zFWlsNmCUGjxySDqi1dCnN2CTjBU83MtB7qxEx06MPMyMU X-Received: by 2002:a17:902:9a8d:b0:1ca:12f3:6775 with SMTP id w13-20020a1709029a8d00b001ca12f36775mr3581312plp.33.1700696424856; Wed, 22 Nov 2023 15:40:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700696424; cv=none; d=google.com; s=arc-20160816; b=CyF0QPtH3o5LuJVU1iGDhQvm8fKPRIzPi2GNuHtYggMuvtPmFnVWRTCFwyz3h7rVuz Te7Ej+0L/IDn3i4MZ9bUib5+cqPNU82xVGAnzFbpO/gRMGKBrrzU9ALRDSwQBsHBAKVP 5V1hHy4BC30TA1LZCWboMOfJUmUT0M8qoRTHVQSZ+2//fd0hShtwT6Tw9oQ2ld2cD0VH NUI7avbJVOeXnzFwfYq5EXbOtQjcwXp8rDXJiD/W6QNTVgrxiYxj2PZ9g30XDjZgqgwT UROortVpTCclemW5G+Z12IE5UMWsh4E5A9Px5Ha1W4w2Q4rs0eQOhBnUAE0Fbak95jRR XdYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=CTOEMFDe24CcawDbpqI8rRhvGeiKsZMYCpriyAZ9TQI=; fh=EP5ONyipI0seBpYMvRCri1chfPMqLdQYI4ZkdC1FhcA=; b=PPiqoC6kD/32HADwntu3iUkSt+4zLGUDgFyIGKrLcsnKpGA/0TXU6547In3zdpkbEe cRct2eeURVLfZ0RMW0QbjZHmDGNHU2v2jONUQuiVzyiSVCIe8HfJfMKrQKzo4V4+bb5y 4zKAA1vWYR6lZtghKM81pfcAOBZPNDCeIQtq9SUAsMfyH+eURazcdSPdEQM9X1VHXEO5 y1tV1P6b7NL+DHxUQbtCZOETtrItNkj+euGjxmszO8dwdJ88y5E1DknDqjYji7IiFkl+ T0e4s1Q4ur7AwvM43B1aZ/hd+x0Pn3x6sQaXSdW0pZ8UqInSUXJQwUEG58FKmHDMtbj5 Dofg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="yq4/JRfa"; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ju2-20020a170903428200b001cc1af09466si426673plb.125.2023.11.22.15.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 15:40:24 -0800 (PST) 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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="yq4/JRfa"; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 699398288C83; Wed, 22 Nov 2023 15:33:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232077AbjKVXdO (ORCPT + 99 others); Wed, 22 Nov 2023 18:33:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234675AbjKVXcx (ORCPT ); Wed, 22 Nov 2023 18:32:53 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD45C10CB for ; Wed, 22 Nov 2023 15:32:17 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6cbc8199a2aso317189b3a.1 for ; Wed, 22 Nov 2023 15:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1700695937; x=1701300737; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CTOEMFDe24CcawDbpqI8rRhvGeiKsZMYCpriyAZ9TQI=; b=yq4/JRfaBb4CRyLmq9pjTiCXW8nz2NeAGLTCuMxURiWE1L0HS+x+hO4RB0WzFK3pFJ gUiZ9kAOH0YMeO5aWnfboJD3xpcRpY8txMwIBokRbHc83FdC4qt1BMyGqOG4+k95t19l LMUN6/5XFck9jo2i1O+wKBZjuDwxdjUf3HzbNCDV/gEk6maY6LfdIA55sMdWi8hjlNNQ PX+V/mf2WCz6xhntL3YyPpz6/hJSgE2m/mTNRBGN+8/A1ta4PxaY+ludbr6casVn6OaX b03OY6ZNR/r6xPWMP0U+K/z10YkSlDxhwxp/3SNfza1uwVR7Pbbe6uSeSsUvJTcXnazc V7bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700695937; x=1701300737; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CTOEMFDe24CcawDbpqI8rRhvGeiKsZMYCpriyAZ9TQI=; b=Lu8BiqEgu2wZlgBXspPfhBFESSXFzdQ0jWO2Dye8l8OEba7auX9mhj8kxjy5oHJZhk l0AzPSD5+NPNsYuUVDC92Z9VHdlIHE27SkvyELoZgNu+DA8mxPvjYy+/6mavL4OEZeeU uyC2LfFUDfiGfXPXHx5cr9TgNr8gMCfjl9S04w382ShK+SpTAI+TgTsplrmc2+9g6Hbn aEsvNdH+LUPUmWaZzzHhRk01MYCEbTT3RF9zArPRJY0aLoDSabhjoHXOuzopf9qKXcoh PvPAMIksrUyeiDRsrisSmILqUIC85TEVD9iQps8GlmBAkYYaAIcf8HS3NgLj0bKgakoA QaPw== X-Gm-Message-State: AOJu0YySUZXNeQWS5rJpzCAVmszVi4lZlcgt/HlipnnmHpctUISqCNyG jnKfzXPhcZ0ZPWeVDclLxO4wDQ== X-Received: by 2002:a05:6a00:6c8e:b0:690:3b59:cc7b with SMTP id jc14-20020a056a006c8e00b006903b59cc7bmr4648756pfb.32.1700695936871; Wed, 22 Nov 2023 15:32:16 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id e22-20020aa78c56000000b006c875abecbcsm22603pfd.121.2023.11.22.15.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 15:32:16 -0800 (PST) From: Charlie Jenkins Date: Wed, 22 Nov 2023 15:31:42 -0800 Subject: [PATCH v3 2/2] riscv: Correct type casting in module loading MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231122-module_linking_freeing-v3-2-8e9e412a3305@rivosinc.com> References: <20231122-module_linking_freeing-v3-0-8e9e412a3305@rivosinc.com> In-Reply-To: <20231122-module_linking_freeing-v3-0-8e9e412a3305@rivosinc.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Ron Economos , Samuel Holland Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1700695933; l=1122; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=JEDtvtgEBmFqCKNc+NtpG6SnBh4nM+PNkCAzWthvfGI=; b=agKzcrFlKLjzZJouJQrrVp+E78ppa6q038/I46LaMQxzZRAByfrJC5J1zXsrBngNF8BddyoyG ULuT+Dr5K2OBcOy66Mu2Kl/sIi2+HtIaRq7LtTQ2aV/x88utv/NoJX/ X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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]); Wed, 22 Nov 2023 15:33:36 -0800 (PST) Use __le16 with le16_to_cpu. Fixes: 8fd6c5142395 ("riscv: Add remaining module relocations") Signed-off-by: Charlie Jenkins Reviewed-by: Samuel Holland Tested-by: Samuel Holland --- arch/riscv/kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index fd9a5533518c..b570988e7d43 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -66,7 +66,7 @@ static bool riscv_insn_valid_32bit_offset(ptrdiff_t val) static int riscv_insn_rmw(void *location, u32 keep, u32 set) { - u16 *parcel = location; + __le16 *parcel = location; u32 insn = (u32)le16_to_cpu(parcel[0]) | (u32)le16_to_cpu(parcel[1]) << 16; insn &= keep; @@ -79,7 +79,7 @@ static int riscv_insn_rmw(void *location, u32 keep, u32 set) static int riscv_insn_rvc_rmw(void *location, u16 keep, u16 set) { - u16 *parcel = location; + __le16 *parcel = location; u16 insn = le16_to_cpu(*parcel); insn &= keep; -- 2.42.0